wait until process ends