Add code to make the application exit gracefully instead of having to kill it

The application will now correctly set the flags to tell the timers to
stop spawning new timers. This should make the application exit gracefully
after the last timer runs. Better than having to Crtl+C the program
every run.