md: Avoid waking up a thread after it has been freed.