making sure parent dirs are created before writing dta