Often one needs to disconnect/close an ssh session while keeping the terminal running, and this can be easily do by making use of the often forgotten “Escape Character”, which by default is the “~” Tilde key. When you want to end the session just hit the following 3 keys (not concurrently):

[Return]~.

The “Escape Character” can also be set by using the -e parameter.

For the ultimate reference refer to the OpenBSD ssh reference.