HtmlUnit should release its resources when the webClient reference is no longer held. 

Patch by: amitmanjhi
Review by: kprobst (TBR)



git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@5946 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/user/src/com/google/gwt/junit/RunStyleHtmlUnit.java b/user/src/com/google/gwt/junit/RunStyleHtmlUnit.java
index f58906d..d740fab 100644
--- a/user/src/com/google/gwt/junit/RunStyleHtmlUnit.java
+++ b/user/src/com/google/gwt/junit/RunStyleHtmlUnit.java
@@ -97,14 +97,13 @@
             + ((HtmlPage) page).asXml());
       } catch (FailingHttpStatusCodeException e) {
         treeLogger.log(TreeLogger.ERROR, "HTTP request failed", e);
-        return;
       } catch (MalformedURLException e) {
         treeLogger.log(TreeLogger.ERROR, "Bad URL", e);
-        return;
       } catch (IOException e) {
         treeLogger.log(TreeLogger.ERROR, "I/O error on HTTP request", e);
-        return;
       }
+      webClient.closeAllWindows();
+      return;
     }
 
     /**