added alarm_done to quit main thread and wait for pending alarms to finish.