Use Lucene's CodecUtils instead of custom header writing logic