Fixed 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