Fix conditional for closing the SSH session

The session method will create a session if one doesn't exist, which
defeats the purpose of it.