Updated June 15th, 2019.
It’s easy to close the active window on a Mac: just click the red button at the window’s top left. You can do it from the keyboard also: Close Window is Command-W (⌘-W).
If you have several windows open, it takes several clicks: one per window. But, if you hold the Option key while clicking a close box, all windows from that app will close. Works in Finder, Mail, and Safari, and many others (but not all).
Note: adding the Option key to the Command-W keyboard shortcut often closes all windows also, but not always. Try Command-Option-W and see.