Flush loggers in Application::Exit

fixes #6861