code: private void cleanupConnection(TaskListener listener) {
          // we might be called multiple times from multiple finally/catch block, 
          if (connection!=null) {
              connection.close();
              connection = null;
              listener.getLogger().println(Messages.SSHLauncher_ConnectionClosed(getTimestamp()));
          }
      }
docs: Called to terminate the SSH connection. Used liberally when we back out from an error.