server: Wait for connection threads to exit before unloading plugins.