write to file. close #24