Changed loop to run until process turns zombie.

The loop earlier used to run indefinitely and could be halted only by raising a KeyboardInterrupt. This loop is halted as soon as the subprocess finishes execution and turns into a zombie.