Change from using bufio to separate thread for writing to file