Ensure shutdown of websocket connection on exn