@Override protected void finalize() throws Throwable { super.finalize(); writer.flush(); writer.close(); }