Added check for closed connection in ssh.reset() method

A trivial check to make sure the connection isn't already closed.

This fixes a weird behaviour we encountered: asynchronous code called in an exit function will be executed _after_ the exit function has finished, thus ssh.end() has been already called and the socket is present but closed. At that point calling ssh.reset() stalls forever because the connection will not emit a new 'close' event.