Fix safe handling when app isn't frontmost

Turns out viewWillDisappear isn't actually called unless you are transitioning to a different view. So we use `applicationWillResignActive:` instead.