While investigating fork() behavior, found another threading bug

We weren't able to exit if we had a thread running in the background,
since we released the GIL at the end of the C level main() and the
background thread would start running again after all the data structures
had been torn down.

Now, just keep holding the GIL as we exit.