Create intermediate directories before saving files