Destroy the gateway connection on error, so reconnection works also when the connection is dropped instead of closed.