--- 
+++ 
@@ -24,6 +24,7 @@
      */
     public void close() throws IOException {
         if (!this.closed) {
+            this.finish();
             super.close();
             this.closed = true;
         }
