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

  (:import [java.io
            DataInputStream DataOutputStream
            FileInputStream FileOutputStream]
           [java.nio.file Files StandardCopyOption]))

;; A useful overview over fsync on Linux:
;; https://www.usenix.org/conference/osdi14/technical-sessions/presentation/pillai


(defn delete-store

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


(defn new-fs-store
