When the server process is terminated, wait for the children to exit