thread-pool: Unref source after mainloop has quit to avoid races in GLib