On macOS, why does closing windows not quit the app?

I'm on macOS and I'm trying to understand the usability decisions behind the close action on some application windows. I have just started terminal:

enter image description here

Nothing to see here of relevance: terminal has been opened, and it's clear in the bottom right of the taskbar that it's running as it has a dot underneath the terminal icon to show that it's running.

Next, I click the close icon at the top left of the window:

enter image description here

As you can see, it appears that, in spite of me closing the window and closing the application, terminal is still running as evidenced by the taskbar still showing the icon showing that it is running.

Why does close not mean close? I have noticed that this functionality is divergent, some applications actually close and some don't.

If I right click on the application and close it, it actually does close.

Why does using the close window button not actually close some applications? If I wanted it minimized, I would have used the minimize button.