Fixed potential memory leak in TransportHeartbeat

- Always end connections when the server command comes in to remove the connection
- Added state transitions to the Transport so that we can detect what transitions happened throughout the lifetime of the connection.