Three levels, from small to large:

  • W closes the window in front. The app stays open, with a dot under its Dock icon and its menu bar still in place.
  • W closes every window of that app. Holding also turns the red button into a close-all button, and File → Close into Close All.
  • Q quits the app: windows close, the dot disappears, memory is freed. This is what Alt+F4 does on Windows.

An app that asks "save changes?" for several documents shows one sheet per document; D is Don't Save in those sheets, is Save.

To clear the whole screen without closing anything, H hides the current app and H hides all the others; the windows come back from the Dock or ⌘Tab.