Imagine an MMO where any troll can take down the server, or where special text in the chat causes everyone's client to crash, or there's a dupe/infinite money glitch.
But I have found that the greatest modding efforts/community can be generated by open source. Balatro for example is easily modified in the sense that although it might not be open source but iirc its lua files are visible.
There are other games as well which have something similar imo although that being said its possible to create modding efforts without open source in general too with say something like for example old versions of counter strike.
Personally I would prefer open source though if its possible but I understand that some game studious might be worried about it but I don't quite understand it if they are shutting down the game anyway though. I think that @mjr00's comments are nice about third party library etc. which cause issues in open sourcing so its good to have a discussion about that too (imo)
That might be fine for very small titles - where the "game server" is a relatively simple binary that can be run anywhere. Larger titles depend on a huge amount of infrastructure, for authentication, progression, matchmaking, etc... It's not feasible to open-source all of that, especially given that it may well still be in use for more recent titles.
It's nice in theory, but in practice many (most?) games are using middleware they don't have the rights to redistribute as open source. IIRC when the source code for Doom, the first major commercial game that went open source, originally came out, it had all of the sound code removed because it was dependent on a third party library. Not that you're going to have sound code in a server, but you may be using third party libraries for networking, replays, anti-cheat, etc.
Which is also a nice side effect to reduce intellectual property barriers for developers that do already want to distribute their server or source code.
We all agree there is a foolproof method to fixing all bugs - delete all the code.
We also all probably agree that isn't the optimal balance.