The error happens inside a child process which does after the sleep. The while loop is simply creating the child process every time. So in that sense I don't believe exiting the parent will improve the behavior.