 
 (defn- process-output
   "Writes the records to the next output file and resets the record buffer"
-  [{:keys [verbose
-           records
+  [{:keys [records
            output-folder
            file-name
            output-paths

                   (try
                     (->> (read-source :gnucash input-stream)
                          (transduce
                            (comp filter-record
                                  append-record
                                  (partial notify-record progress-chan))
                            evaluate-output
                            {:output-paths []
                             :verbose (-> opts :options :verbose)
                             :records []
                             :max-record-count (-> opts :options :maximum)
                             :file-name (second (re-matches #"^(.+)(\..+)$" file-name))

                              output-folder
                              file-name
                              (count output-paths))]
      (>!! progress-chan [:message "compressing and writing records..."])
      (binding [*print-meta* true]
        (with-open [writer (io/writer (GZIPOutputStream. (FileOutputStream. output-path)))]
          (with-precision 4
            (.write writer (prn-str records)))))
      (>!! progress-chan [:message output-path])
      (-> context
          (assoc :records [])
          (update-in [:output-paths] #(conj % output-path))))
    context))

(def ^:private chunk-file-options
  [["-m" "--maximum MAXIMUM" "The maximum number of records to include in each output file"
    :parse-fn #(Integer/parseInt %)
    :default 1000]])

