Handle kill signals gracefully

Not sure what you mean, when `$child_pid == 0`, that is in the child process.  Then the parent process tries to kill the child, sleep 2 seconds, then checks the memory cache.  If the child process never forked or never properly finished, the worker_finished check will fail.