add wait() to subprocess