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