Wait for process p to terminate.

Haha. We suck at java. So much python in our veins :)