Properly close the command when the connection close unexpectedly.

We need to properly handle three cases:

- eofReceived(): we receive an EOF on the SSH channel, we need to
  close the stdin of the process and let it deal with that.
- closed(): the connection is closed, we need to kill the process
- the connection is closed while we were (asynchronously)
  authenticating: we need to not open the process.

Most of the code is taken straight from `twisted.conch.unix`.