NH-3679 fix SchemaExport to file using SetOutputFile and Create

Unit test and proposed fix for NH-3679