In order to close all the openned windows of a app in Mac, Click on the Red Close icon located on top left of any window of that app while holding down the Option key (Alt key for window keyboard). This will cause all the windows to close down. You will get a chance to save or ignore the changes to your document/image etc. before it closes down.
This shortcut can be handy esp. when you have lot of windows open in the app (sometime app opens up all the recent openned windows like in Pixelmator) and the app does not have way to close all but one by one. This saves time and computer resources. <!>