close write file