File writing preparing