preliminary write file