Popen calls working but need to implement wait