Close all applications in Mountain Lion
The Finder should safely quit any open apps whenever you logout or reboot. If there is a document with unsaved changes It will prompt you to save or discard the changes before quitting. The keyboard shortcut is Command-Option-Shift-Q.

If you do not want all the apps restarting when you log back in, uncheck the "Reopen windows when logging back in" checkbox in the logout dialog.