Fix up close handling in websockets