Repository: flutter
Issue: [tool_crash] StateError: Bad state: Cannot add event after closing
Labels: c: crash,tool,platform-web,P2,team-web,triaged-web

## Command
```
flutter run -d chrome
```

## Steps to Reproduce
1. ... flutter clean
2. ... flutter run -d chrome
3. ...

## Logs
StateError: Bad state: Cannot add event after closing
```
#0      _StreamController.add (dart:async/stream_controller.dart:596:24)
#1      _StreamSinkWrapper.add (dart:async/stream_controller.dart:876:13)
#2      AppConnection.runMain (package:dwds/src/connections/app_connection.dart:32:22)
#3      _ResidentWebRunner.attach (package:flutter_tools/src/build_runner/resident_web_runner.dart:707:41)
<asynchronous suspension>
#4      _ResidentWebRunner.run.<anonymous closure> (package:flutter_tools/src/build_runner/resident_web_runner.dart:455:16)
<asynchronous suspension>
#5      _ResidentWebRunner.run.<anonymous closure> (package:flutter_tools/src/build_runner/resident_web_runner.dart)
#6      asyncGuard.<anonymous closure> (package:flutter_tools/src/base/async_guard.dart:111:32)
#7      _rootRun (dart:async/zone.dart:1190:13)
#8      _CustomZone.run (dart:async/zone.dart:1093:19)
#9      _runZoned (dart:async/zone.dart:1630:10)
#10     runZonedGuarded (dart:async/zone.dart:1618:12)
#11     runZoned (dart:async/zone.dart:1547:12)
#12     asyncGuard (package:flutter_tools/src/base/async_guard.dart:109:3)
#13     _ResidentWebRunner.run (package:flutter_tools/src/build_runner/resident_web_runner.dart:403:20)
<asynchronous suspension>
#14     RunCommand.runCommand (package:flutter_tools/src/commands/run.dart:564:37)
<asynchronous suspension>
#15     FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:797:18)
#16     _rootRunUnary (dart:async/zone.dart:1198:47)
#17     _CustomZone.runUnary (dart:async/zone.dart:1100:19)
#18     _FutureListener.handleValue (dart:async/future_impl.dart:143:18)
#19     Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:696:45)
#20     Future._propagateToListeners (dart:async/future_impl.dart:725:32)
```
```
[✓] Flutter (Channel beta, 1.19.0-4.1.pre, on Linux, locale en_GB.UTF-8)
    • Flutter version 1.19.0-4.1.pre at /home/azzam/Desktop/flutter
    • Framework revision f994b76974 (9 days ago), 2020-06-09 15:53:13 -0700
    • Engine revision 9a28c3bcf4
    • Dart version 2.9.0 (build 2.9.0-14.1.beta)

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    • Android SDK at /home/azzam/Android/Sdk
    • Platform android-29, build-tools 29.0.2
    • Java binary at: /usr/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-8u242-b08-0ubuntu3~18.04-b08)
    • All Android licenses accepted.

[✓] Chrome - develop for the web
    • Chrome at google-chrome

[!] Android Studio
    • Android Studio at /home/azzam/Downloads/android-studio/bin/studio.sh
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
    ✗ android-studio-dir = /home/azzam/Downloads/android-studio/bin/studio.sh
    ✗ Android Studio not found at /home/azzam/Downloads/android-studio/bin/studio.sh
    • Try updating or re-installing Android Studio.
    • Consider removing your android-studio-dir setting by running:
      flutter config --android-studio-dir=

[✓] VS Code (version 1.45.1)
    • VS Code at /usr/share/code
    • Flutter extension version 3.11.0

[✓] Connected device (2 available)
    • Web Server • web-server • web-javascript • Flutter Tools
    • Chrome     • chrome     • web-javascript • Google Chrome 83.0.4103.106

! Doctor found issues in 1 category.

```

## Flutter Application Metadata
**Type**: app
**Version**: 1.0.0+1
**Material**: true
**Android X**: false
**Module**: false
**Plugin**: false
**Android package**: null
**iOS bundle identifier**: null
**Creation channel**: beta
**Creation framework version**: f994b769743368b36b9c03fb359f62230b60ab92
### Plugins
cloud_firestore-0.13.6
cloud_firestore_web-0.1.1+2
file_picker-1.12.0
firebase_core-0.4.5
firebase_core_web-0.1.1+2
firebase_storage-3.1.6
flutter_plugin_android_lifecycle-1.0.8