totalngrams: use buffered output streams
diff --git a/src/main/java/org/ids_mannheim/TotalNGram.java b/src/main/java/org/ids_mannheim/TotalNGram.java
index 5de0f84..d09012b 100644
--- a/src/main/java/org/ids_mannheim/TotalNGram.java
+++ b/src/main/java/org/ids_mannheim/TotalNGram.java
@@ -3,6 +3,7 @@
 import org.anarres.parallelgzip.ParallelGZIPOutputStream;
 import picocli.CommandLine;
 
+import java.io.BufferedOutputStream;
 import java.io.File;
 import java.io.FileOutputStream;
 import java.io.PrintStream;
@@ -17,6 +18,7 @@
 import java.util.logging.SimpleFormatter;
 import java.util.stream.Collectors;
 import java.util.stream.IntStream;
+import java.util.zip.GZIPOutputStream;
 
 
 @CommandLine.Command(mixinStandardHelpOptions = true,
@@ -116,9 +118,9 @@
                 }
             }
             if (output_fillename.endsWith(".gz")) {
-                output_stream = new PrintStream(new ParallelGZIPOutputStream(new FileOutputStream(f)));
+                output_stream = new PrintStream(new ParallelGZIPOutputStream((new BufferedOutputStream(new FileOutputStream(f)))));
             } else {
-                output_stream = new PrintStream(f);
+                output_stream = new PrintStream(new BufferedOutputStream(new FileOutputStream(f)));
             }
 
         }
@@ -159,6 +161,7 @@
                 .forEachOrdered(i -> output_stream.print("\t" + map.values()
                         .parallelStream().mapToLong(e -> Integer.toUnsignedLong(e.count.get(i))).sum()));
         output_stream.println("\t" + map.values().parallelStream().mapToLong(e -> Integer.toUnsignedLong(e.count.get(0))).sum());
+        output_stream.close();
         return null;
     }
 }