Repository: flutter
Issue: Logs emitted when killing app after switching from another app: `No windows have a root view controller, cannot save application state`
Labels: platform-ios,tool,engine,has reproducible steps,P3,found in release: 3.3,found in release: 3.7,team-ios,triaged-ios

## Steps to Reproduce

<!-- Please include full steps to reproduce so that we can reproduce the problem. -->

1 - Create a default flutter app ( the counter app).
2 - Try to press the home button and keep the app in the background.
3 - Try to open another app to let the flutter app be the first app in the multitask.
4 - Try to kill the app in the multitask.

**Expected results:** 
The app is disconnected without an error.

**Actual results:** 
The app is disconnected but with an error.

<details>
  <summary>Logs</summary>
  
     1 - No windows have a root view controller, cannot save application state
     2 - [ApplicationLifecycle] UIWindows were created prior to initial application activation. This may result in incorrect visual         appearance.
     3 - [_UIRemoteKeyboards proxy]_block_invoke Failed to access remote service: Error Domain=NSCocoaErrorDomain Code=4099        "The connection to service named com.apple. UIKit KeyboardManagement hosted was invalidated from this process." UserInfo={NSDebugDescription=The connection to service named com .apple. UIKit. KeyboardManagement. hosted was invalidated from this process.}
- Lost connection to device.
</details>

<details>
  <summary>Flutter doctor -v</summary>
  
      [✓] Flutter (Channel stable, 3.3.9, on macOS 13.0.1 22A400 darwin-arm, locale en-LB)

       • Flutter version 3.3.9 on channel stable at
        /Users/hassanyassin/Desktop/Flutter/Development/Tools/flutter
       • Upstream repository https://github.com/flutter/flutter.git
       • Framework revision b8f7f1f986 (9 days ago), 2022-11-23 06:43:51 +0900
       • Engine revision 8f2221fbef
       • Dart version 2.18.5
       • DevTools version 2.15.0

      [✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
      • Android SDK at /Users/hassanyassin/Library/Android/sdk
      • Platform android-33, build-tools 33.0.0
      • Java binary at: /Applications/Android
        Studio.app/Contents/jre/Contents/Home/bin/java
      • Java version OpenJDK Runtime Environment (build
        11.0.13+0-b1751.21-8125866)
      • All Android licenses accepted.

      [✓] Xcode - develop for iOS and macOS (Xcode 14.1)
      • Xcode at /Applications/Xcode.app/Contents/Developer
      • Build 14B47b
      • CocoaPods version 1.11.3

      [✓] Chrome - develop for the web
      • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

      [✓] Android Studio (version 2021.3)
      • Android Studio at /Applications/Android Studio.app/Contents
      • Flutter plugin can be installed from:
        🔨 https://plugins.jetbrains.com/plugin/9212-flutter
      • Dart plugin can be installed from:
        🔨 https://plugins.jetbrains.com/plugin/6351-dart
      • Java version OpenJDK Runtime Environment (build
        11.0.13+0-b1751.21-8125866)

      [✓] Connected device (4 available)
       • iPhone X (mobile)          • 08f6d5d4e6ac65273a8757fc2424f2f593e6ca56 •
         ios            • iOS 16.1.1 20B101
       • iPhone 14 Pro Max (mobile) • B6B4CDD3-90C8-451E-B16D-563A2EF56E5F     •
         ios            • com.apple.CoreSimulator.SimRuntime.iOS-16-1 (simulator)
      • macOS (desktop)            • macos                                    •
       darwin-arm64   • macOS 13.0.1 22A400 darwin-arm
      • Chrome (web)               • chrome                                   •
       web-javascript • Google Chrome 108.0.5359.71

      [✓] HTTP Host Availability
      • All required HTTP hosts are available

      • No issues found!

</details>


**Note**: The third error in the logs down sometimes it appears with the same steps that I'm doing in the video, so it's rarely to appear, in every 10 tries to appear one time I don't know why!

Tested on iPhone X (real device) iOS version 16.1.1

https://user-images.githubusercontent.com/94860683/205090539-65869ad2-f386-4dea-9497-554e850598df.mov