title: When I try to close ssh2 connection, no response back
body: <p>I wrote a php script to execute locally, on an apache server with php7.3, doing the following:</p>
  
  <ol>
  <li>access server via ssh2</li>
  <li>check if a file exists</li>
  <li>close connection</li>
  <li>printing json data object as a response.</li>
  </ol>
  
  <p>script works without problems except for closing connection. if I add ssh2_disconnect function, no response comes back. What am I missing?
  Here is my code:</p>
  
  <pre><code>&lt;?php
  
  error_reporting(1);
  ini_set('display_errors', '1');
  
      $config = ["server"=&gt;"10.1.201.1","port"=&gt;"22","user"=&gt;"root","password"=&gt;"root","folder"=&gt;"/"];
      $files = ["file1.pdf","file2.pdf"];
      $result = [];
      $ftpConnect = ssh2_connect($config['server'],$config['port']);
          ssh2_auth_password($ftpConnect,$config['user'],$config['password']);
      $sftp = ssh2_sftp($ftpConnect);
  
  foreach ($files as $file){
      $fileExists = file_exists("ssh2.sftp://". intval($sftp) . $config['folder'] . $file);
          if($fileExists){
              $result[$file]= ["status"=&gt;"Found"];
          }else $result[$file]= ["status"=&gt;"Not found"];
  }
  //ssh2_disconnect($ftpConnect); only if uncommented, script wouldn't work
  header('content-type:text/json; charset=UTF-8');
  echo json_encode($result);
  ?&gt;
  </code></pre>