                 (finally
                   (close! res-ch)
                   (.clear bb)
+                  (.release lock)
                   (.close ac))))
             (go-try-
                 (<?- (update-file folder path serializer write-handlers buffer-size key-vec env [nil nil]))
               (finally
+                (.release lock)
                 (.close ac)))))
         (go nil)))))
 

        (migrate-file-v1 folder key env buffer-size old-file-name file-name serializer read-handlers write-handlers))
      (if (or file-exists? (= :write-edn operation) (= :write-binary operation))
        (let [standard-open-option (if file-exists?
                                     (into-array StandardOpenOption [StandardOpenOption/READ])
                                     (into-array StandardOpenOption [StandardOpenOption/WRITE
                                                                     StandardOpenOption/CREATE]))
              ac                   (AsynchronousFileChannel/open path standard-open-option)]
          (if file-exists?
            (let [header-size 8
                  bb          (ByteBuffer/allocate header-size)

               (recur (into list-keys
                            (loop [meta-list-keys #{}
                                   [meta-path & meta-file-names]
                                   (vec (Files/newDirectoryStream path))]
                              (if meta-path
                                (let [old-file-name (-> meta-path .toString)
                                      file-name     (str folder "/" (-> meta-path .getFileName .toString) ".ksv")
