tolerant exit/close for ssh commands