write file and keep buffer