wait for child processes to finish