Kill the heartbeat thread when closing the session