add closing delimiter to to_hl7 w/ optional flag