Remote SSH sessions will often freeze after a period of inactivity. Sure you can simply close the terminal but a better option is to properly disconnect from a frozen shell. Doing so is simple.
Press ENTER or RETURN
Enter a ~
Enter a .
That should be all that is necessary to leave.