I haven't found a way to disable it, but I haven't been looking.
I sometimes get that message when macOS is trying to close Safari when I try shutting down a system, but not always. I just tried closing Safari and it quit immediately with no complaints. I reopened it again and asked it to restore all windows from my previous session and it did so with no problems.
If it helps, I think that message appears when I have a pop-up notice that I haven't dismissed, but there may be other conditions as well.
Location: Asia Pacific, Cyberspace, in the Dark Dystopia
Thanks Given: 2,039
Thanked 2,708 Times in 1,495 Posts
I had a similar issue recently when my automatic 2AM scheduled shutdown of the MacPro happens with the Terminal app open. I would wake up and see the Mac was in "do you really want to quit the terminal" mode and not shut down (man, I hate that .. LOL), but I found a preferences option to avoid this problem.
Now, when testing web dev apps in Safari, especially on login and registration pages where there are passwords to save, Safari will also stop an automatic shutdown. That's annoying for sure.
This 12 core MacPro uses so much electricity and generates a lot of heat. I don't like it when it runs all night when sleeping, so auto shutdown is a great feature; but now Safari is blocking.
It's not a big deal.
So, I develop on Chrome and test live on the web site with Safari to save time, and that is why I'm noticing all these Safari quirks.
After I get past this major Vue.js UserCP project, I'll use Safari less and I will not notice it again.
Frankly as a developer, If I tried to develop (anything state-of-the-art) on Firefox or Opera, I would get very little done and be miserable, LOL. Those browsers are really falling behind in 2019 and I am quite sure their downward spiral will continue because Chrome is focused on modern web apps and Firefox is focused on "privacy" and seeming trying to block modern web apps. This is fight which FF will lose for sure with developers. Safari works fine. Opera, well, I open it from time to time, but never use it for anything "useful" from a web dev perspective.