added timed wait when waiting for terminated children