   a header structure and a sequence of chromosome data."
   [^BIGWIGReader rdr]
   (let [r ^RandomAccessFile (.reader rdr)]
-    (.seek r 0)
-    (let [headers (read-all-headers r)
-          bbi-chrom-info (read-bbi-chrom-info r (:bpt-header headers))]
-      {:headers headers, :bbi-chrom-info bbi-chrom-info})))
+    (let [bbi-chrom-info (read-bbi-chrom-info r (:bpt-header (.headers rdr)))]
+      {:headers (.headers rdr), :bbi-chrom-info bbi-chrom-info})))

  to ensure the reader is properly closed."
  [f]
  (let [f (.getAbsolutePath (cio/file f))
        reader (RandomAccessFile. f "r")]
    (BIGWIGReader. reader (util/as-url f))))

(defn- check-bigwig-magic
  "Checks if the magic is right for bigWig format. Otherwise, throws IOException."


(def ^:private bpt-magic 0x78CA8C91)

(declare read-structure read-all-headers)

(defrecord FixedWidthHeader [magic version zoom-levels chromosome-tree-offset
                             full-data-offset full-index-offset
