[vm, test] Fix race in shutdown of MessageHandler_Run.
[vm, test] Fix race in shutdown of MessageHandler_Run.

Bug: https://github.com/dart-lang/sdk/issues/39611
Change-Id: I9bd55304646dbc2d1b6fad41b3f31c2ff9384b09
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138049
Reviewed-by: Siva Annamalai <2e618a8cbd7bb6b3d4409061ae407d692a098546@google.com>
Reviewed-by: Martin Kustermann <a35dd5b79fac84b2bb3b026a16b8becc55af5961@google.com>
Commit-Queue: Ryan Macnak <d738b7f001baf9789095d7dc549cff6de60b011d@google.com>

dart-lang/sdk,dart-lang/sdk,dart-lang/sdk,dart-lang/sdk,dart-lang/sdk,dart-lang/sdk,dart-lang/sdk,dart-lang/sdk