Fixed a couple of races with exiting threads in suspend_for_ptrace().