Don't raise if self_ is set

There is a race condition here where if we exit immediately after for
example forking. What happens is that the finalizer thread has just
started, but is still waiting to become dependent in thread.cpp when we
are already shutting down.