Check file modification on app:exit

Prompts for save/discard/cancel when user triggers an app:exit via menu,
button, or palette. Fixes #178.