change file permission after write