Open and wrote to files