Document vs App
This has to do with the distinction between:
- Document windows
- App windows
Close means close. The only question is whether you are closing a document in a multi-document application, or a singular app window and thus the application itself.
(For more: Human Interface Guidelines for MacOs).
Document window
With some applications it makes sense to have the ability to open more than one window, aka document. Examples include:
- Word processor
- Terminal
- Browser
- Graphics application
App window
With some applications it doesn't make sense:
- Calculator
- Most games
- FaceTime
Mac vs Windows - Short history
I haven't used Windows for years, but when I did, you had the app window, within which you had the document windows - and the latter could not extend beyond the boundaries of the former:

This made the whole app vs document windows way clearer: You close the window inside - you close a document; you close the outer window - you close the app.
One problem though - once you could afford a second screen, you had to drag the app window across both screens and organise your documents per screen. This was a MASSIVE PAIN if the two screens did not have the same size/resolution. More so if you had 3 screens.
Mac back then was targeting the creative industries (media, design, graphics), which often used more than one screen. Thus, MacOS did not adopt the document within an app window, but rather an 'it depends' approach.
The caveat? This whole document/window distinction is far more blurry.
You can see more pros and cons of this approach in this wikipedia page on MDI.
It's all quite genius if you look a step further
I doubt Apple weren't aware of the ambiguity and potential annoyance when they made the decision.
But they, as Apple often do, looked one step ahead (this links to usability concepts such as learning curves, progressive disclosure, and performance load). It goes:
- I close the terminal window with the mouse.
- Damn! The bloody app is still open.
- How do I close it?
- I move the mouse all the way to the menu.
- I move the mouse all the way to the Quit option (often, bottom menu item = more mousing to be done).
- Damn! That's a lot of mousing around.
- Hey, what' this? I can use CMD-Q to close the app.
- Ah!!! Better use this next time.
And so, from a novice mouse user you become an expert keyboard user. Then you discover CMD-W.
Although I'm a single sample, I was a bit surprised by your question, because I cannot recall ever noticing this - I have been conditioned very early on to use the keyboard shortcuts as means to articulate my goals.