Minor issue solved in WriteHeaderEnd method