It may not be often that you find your Mac with many open Finder windows or multiple windows of Safari or any other app. But when you do and you want to close them all at once, you have two options.
The first is the Command + Option + W. The second one involves mouse clicks. If you're not the three-key-shortcut type, you'll want to check out how to close all windows of a Mac app (including Finder) with this keystroke + click.
How to Close all Windows in Mac App with Keystroke+Click
Note that this method works for all Finder Windows or multiple instances/windows of other apps (including browsers etc).
#1. With the app/Finder open, click on File from the top menu.
#2. Now, press the Option/Alt key on your Mac keyboard.
#3. You should notice that the Close option changes to Close All.
#4. Click on Close All and all the windows will be quit/closed.
That's it. Being a keyboard-shortcuts guy, I've wondered if this one helps. But I realize, of late, that this tip will be helpful for those working their mice a lot (I'm thinking digital artists).
There is one interesting exception to this though. While in Finder, or Chrome the default option is Close and the Close All (or Close All Windows) option shows only when you press Alt/Option. But in Safari, when you have multiple windows/instances open, you will notice that Close All Windows shows up even without pressing the Alt/Option key.
You should remember that this method will close windows, which means all unsaved work will be lost. For instance, if you've got multiple websites open in different windows of Chrome, closing all windows will lose all the open data. By default, browsers only ask you when you try to close multiple tabs so even this feature won't save data.
The method didn't work for apps like Microsoft Word in Yosemite so the implementation seems to be specific to some apps.