Command+Option+Eject will quit all applications and restart your Mac, and you’ll be prompted to save whatever documents you have open in each application before it closes.
Command+Option+Control+Eject will quit all your applications and shut down your computer with the same prompts to save open documents.