Close terminal on websocket disconnect