close BufferedWriter after finish writing