Shutdown event loops on server termination to prevent hanging threads