Fix race condition by blocking SIGCHLD