Refactor handle_child_close to handle SIGCHLD arriving before the final status line