Added graceful shutdown on SIGHUP

Please add a note here that is_keepalive is mutated from within task.py