Destroy the gateway connection on error, so reconnection works also when the connection is dropped instead of closed.
Merge pull request #3 from nrcmedia/master

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