wait child process to finish