Add "Closing" state to Application, use it to distinguish user-induced close from app-induced close. Don't clear QML cache if user-induced.
Much code taken from a partially-related branch by Nick Dedekind:
https://code.launchpad.net/~nick-dedekind/qtmir/polite-close/+merge/262188
Note there is 1 disabled test, which needs additional work to fix. Fixes: #1500372
Approved by: PS Jenkins bot