Changed heartbeat thread to daemon so that it does not continue after a program exits.