Make use of the neat finally function in the daemonize code