I’ve seen it where if you put AllowAutoQuit before a long process and no window opens in time the app quits too early, so I always put it as the last instruction of whatever opening procedure I’ve created (sometimes there’s an asynchronous chain of events).
In addition to Tim’s answers, I’d just like to point out that this behaviour is the expected one on Mac (for document-based apps). A user may close every window and then want to create a new document from the left-running app.
If you change this behaviour solely because it’s how it works on Windows and Linux, your users may be angry.
In my case it has been more a complaint or observation from macOS users. It is a logging application and users expect the application to shutdown when they close the main window.
Depending on your app design, this may be the correct behavior.
Document design; where an application may have more than one editable content window (a document) open at once, it typically will remain open after all the windows are closed. A Text Editing application is typically a “Document” based application.
Shoebox design; a single window application, will typically quit when closing the only window. iTunes / Apple Music is considered a Showbox design.