Added support for writing files with updated metadata