revise tei creation to avoid fs loop and use non-gz xmd for headers