diff --git a/core/src/util/file.rs b/core/src/util/file.rs
index 0415ec131..4a519d4a0 100644
--- a/core/src/util/file.rs
+++ b/core/src/util/file.rs
@@ -1,4 +1,4 @@
-//! Core file operations
+//! Core file operationscorefil
 use cached::proc_macro::cached;
 use cached::UnboundCache;
 use glob::Pattern as GlobPattern;
@@ -230,6 +230,13 @@ impl XvcPathMetadataProvider {
     }
 }
 
+impl Drop for XvcPathMetadataProvider {
+    /// Stop the background thread when quit
+    fn drop(&mut self) {
+        self.stop().unwrap();
+    }
+}
+
 /// A parallel directory walker.
 /// It starts from `start_dir` and sends [PathMetadata] by traversing all child directories.
 /// It uses [xvc_walker::walk_parallel] after building an empty [IgnoreRules].