When opening files, create their parent directories if they don't exist.