Mac how to remove instance icon from array
It sounds like the issue you are facing is converting from Windows to Mac.

In macOS most applications are disassociated from the closing of windows, an example would be in the Safari web browser. If you close all the windows the application remains open because you only closed the windows, you didn't quit the application.

This is signifciantly different from Windows where closing a window typically quit the application.

In some applications on macOS closing the last window will quit the application but it isn't standard or default behaviour.

There is no option to make this happen. You can quit the application using ⌘ + Q (Command + Q), the shortcut you mentioned you forgot is  Command + W.

Essentially Command + W is not the same as Alt + F4 and there is no way to make macOS behave this way as unlike Windows you cannot easily make macOS open multiple applications from the same link, i.e. clicking Chrome twice doesn't open two Chrome windows, it opens Chrome then brings it to the front on the second click.