Adding HeartBeat thread termination on server exiting.