I'm seeing this error in the logs when closing Unity (both batch mode and editor mode)
[Package Manager] Server::Kill -- Server was shutdown
Cleanup mono
GetBool is not allowed to be called while application is terminating.
(Filename: /Users/builduser/buildslave/unity/build/Runtime/Scripting/ScriptingThreadAndSerializationSafeCheck.cpp Line: 85)
Unhandled Exception: UnityEngine.UnityException: GetBool is not allowed to be called while application is terminating.
at <0x00000> <unknown method>
at <0x00000> <unknown method>
at <0x00000> <unknown method>
at <0x00000> <unknown method>
This comes from hooking into System.AppDomain.CurrentDomain.DomainUnload in order to act upon RevertExternalScriptEditorOnExit preference setting. When the callback is triggered, the Enabled property is queried, which results in this issue.
I don't know what the solution is, but this needs to be reworked to allow Unity to exit cleanly.