diff --git a/lib/src/runner/browser/server.dart b/lib/src/runner/browser/server.dart
index e96fc57648bef0db10494aa42e62a4817c132408..b5f5f3f1b8bfa102d6cbf36a195b208cd85682d6 100644
--- a/lib/src/runner/browser/server.dart
+++ b/lib/src/runner/browser/server.dart
@@ -165,6 +165,8 @@ class BrowserServer {
             .then((_) => _pubServeUrl.resolve('$suitePrefix.html'));
       } else {
         return _compileSuite(path).then((dir) {
+          if (_closed) return null;
+
           // Add a trailing slash because at least on Chrome, the iframe's
           // window.location.href will do so automatically, and if that differs
           // from the original URL communication will fail.