throw exception if shell session is closed