Only close the open dialog if the connection succeeds
Only save the session if the connection succeeds