Check for upgrade/maintance mode before trying to load an app

Otherwise upgrades won't be done if the user is in an app.

@DeepDiver1975 @butonic @karlitschek