Do not show message box when the application is visible and the user logs off.
(cherry picked from commit b220f1504564acc04f78b63db08728edf0314821)