Fix the behavior of ExecuteAndWait with a non-zero timeout.