         (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/READ
+                                                                     StandardOpenOption/WRITE])
                                      (into-array StandardOpenOption [StandardOpenOption/WRITE
                                                                      StandardOpenOption/CREATE]))
-              ac                   (AsynchronousFileChannel/open path standard-open-option)]
+              ac                   (AsynchronousFileChannel/open path standard-open-option)
+              lock                 (.get (.lock ac))]
           (if file-exists?
             (let [header-size 8
                   bb          (ByteBuffer/allocate header-size)

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


               (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")
