             (.flush dos)
             (when (:fsync config)
               (.sync fd))
-            #_(.renameTo new-file f)
+            (.close fos) ;; required for windows
             (Files/move (.toPath new-file) (.toPath f)
                         (into-array [StandardCopyOption/ATOMIC_MOVE]))
             (when (:fsync config)
-              (.sync fd)
-              #_(.sync (.getFD (FileInputStream. (io/file folder)))))
+              (sync-folder folder))
             (catch Exception e
               (.delete new-file)
-              (.sync fd)
               (ex-info "Could not write key."
                        {:type :write-error
                         :key key
                         :exception e}))
             (finally
               (.close fos))))))))
-
 
 
 (defn new-fs-store

              (.flush dos)
              (when (:fsync config)
                (.sync fd))
              (Files/move (.toPath new-file) (.toPath f)
                          (into-array [StandardCopyOption/ATOMIC_MOVE]))
              (when (:fsync config)
                (.sync fd)
                #_(.sync (.getFD (FileInputStream. (io/file folder)))))
              [(get-in old rkey)
               (get-in new rkey)]
              (catch Exception e

  (let [f (io/file folder)]
    (doseq [c (.list f)]
      (.delete (io/file (str folder "/" c))))
    (.delete f)
    (try
      (sync-folder folder)
      (catch Exception e
        nil))))


(defn list-keys
