Fix termination race condition.