Clean-up the delay code to try and trap signals so we exit.

Unfortunately it seems this doesn't work, possibly because the process of spawning the task has stolen all signal handling even after it ended.