Ensure parent directories exist before exporting or saving.