If you ever get an ssh session that seems to be stuck, try closing the connection using one of the ssh built-in escape sequences.
Just type at the beginning of a new line:
If you have to close a remote ssh session that was started from an ssh session, you will have to escape the escape character, and type:
For a list of available escape sequences:
The escape character can be modified using the -e command line option:
ssh -e '_' remote.host.your.domain
For more detail, take a look at the ESCAPE CHARACTERS section of the ssh man page or the following links: