dag: call wait() when the subprocess finishes