complete rewrite
complete rewrite finished and it now exits!

I added a watchdog to kill the script when all the jobs report finishing