BufferedWriter wasn't being flushed