[235495] [hotbug] CatalogWriter.write() does not closing the outputstream -> leaves files locked (wtp 3.0)
diff --git a/bundles/org.eclipse.wst.xml.core/src-catalog/org/eclipse/wst/xml/core/internal/catalog/CatalogWriter.java b/bundles/org.eclipse.wst.xml.core/src-catalog/org/eclipse/wst/xml/core/internal/catalog/CatalogWriter.java
index 1cf4de2..5900e1f 100644
--- a/bundles/org.eclipse.wst.xml.core/src-catalog/org/eclipse/wst/xml/core/internal/catalog/CatalogWriter.java
+++ b/bundles/org.eclipse.wst.xml.core/src-catalog/org/eclipse/wst/xml/core/internal/catalog/CatalogWriter.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2002, 2006 IBM Corporation and others.
+ * Copyright (c) 2002, 2008 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -44,9 +44,17 @@
 
   public void write(ICatalog xmlCatalog, String uri) throws FileNotFoundException, IOException
   {
-    visitCatalog(xmlCatalog);
-    OutputStream outputStream = getOutputStream(uri);
-    serialize(outputStream);
+	OutputStream outputStream = null;
+	try {
+      visitCatalog(xmlCatalog);
+      outputStream = getOutputStream(uri);
+      serialize(outputStream);
+	}
+	finally {
+	  if(outputStream != null) {
+		outputStream.close();
+	  }
+	}
   }
 
   public void write(ICatalog catalog, OutputStream os) throws FileNotFoundException, IOException