Factor out all local SSH disconnections into a new function ssh_disconnect(),