Fixed incorrect implementation of WaitForProcessToDie.