Use Popen.communicate instead of Popen.wait