Properly closing the SSH connection