Writes file after edit