If DocumentInfo contains NULs Ghostscript will generate XMP with NULs which is not allowed. Repair DocumentInfo before Ghostscript sees it.