Fixed potential memory leak in TransportHeartBeat.
- End the connection before removing it from the list in when the server command
  is received so that the subscription is cleaned up.

#1953
Added state tracking to transports.
- Added flags enum to show state transition history
  of a transport. This will make dumps much easier to
  analyze as we'll have more historical data.
Added more states for tracking.
Changed Initialized to None.