Index: lucene/core/src/java/org/apache/lucene/codecs/pfor/PForFactory.java
===================================================================
--- lucene/core/src/java/org/apache/lucene/codecs/pfor/PForFactory.java	(revision 1358755)
+++ lucene/core/src/java/org/apache/lucene/codecs/pfor/PForFactory.java	(working copy)
@@ -45,7 +45,17 @@
 
   @Override
   public IntIndexOutput createOutput(Directory dir, String fileName, IOContext context)  throws IOException {
-    return new PForIndexOutput(dir.createOutput(fileName, context), blockSize);
+    boolean success = false;
+    IndexOutput out = dir.createOutput(fileName, context);
+    try {
+      IntIndexOutput ret = new PForIndexOutput(out, blockSize);
+      success = true;
+      return ret;
+    } finally {
+      if (!success) {
+        IOUtils.closeWhileHandlingException(out);
+      }
+    }
   }
 
   @Override
Index: lucene/core/src/java/org/apache/lucene/codecs/pfor/ForFactory.java
===================================================================
--- lucene/core/src/java/org/apache/lucene/codecs/pfor/ForFactory.java	(revision 1358755)
+++ lucene/core/src/java/org/apache/lucene/codecs/pfor/ForFactory.java	(working copy)
@@ -45,7 +45,17 @@
 
   @Override
   public IntIndexOutput createOutput(Directory dir, String fileName, IOContext context)  throws IOException {
-    return new ForIndexOutput(dir.createOutput(fileName, context), blockSize);
+    boolean success = false;
+    IndexOutput out = dir.createOutput(fileName, context);
+    try {
+      IntIndexOutput ret = new ForIndexOutput(out, blockSize);
+      success = true;
+      return ret;
+    } finally {
+      if (!success) {
+        IOUtils.closeWhileHandlingException(out);
+      }
+    }
   }
 
   @Override
