add writing metadata for dimensions variables as well