I cannot duplicate this. I tried multiple shared and unshared databases on two computers, one running Big Sur and one running Sierra. No crashes closing any kind of window.
On the other hand, there was a change made in the code for closing a database, for the new Always keep database open (even if all windows are closed) option. It was a very minor change, not even one line of code (just a part of one line changed). I don’t see any problem with the code though. The code was already checking if the database was a library database, and if so, making the database secret instead of closing it. Now it also does this if the always keep open option is enabled. If it is not enabled, the code works exactly as before (i.e. closes the database).