diff --git a/src/instance.rs b/src/instance.rs
index a20d4eb225db02ebd1197b10b66069f8df301b8d..b1f1d86028aec3aac7cb78fc020fba1b759e6457 100644
--- a/src/instance.rs
+++ b/src/instance.rs
@@ -12,7 +12,7 @@
 pub(crate) const REPOSITORY_DIRECTORY: &str = "repositories";
 
 pub(crate) struct InstanceLock {
-    _file: File,
+    file: File,
 }
 
 impl InstanceLock {
@@ -40,10 +40,16 @@
             })?;
         validate_private_file(&path, &file)?;
         match file.try_lock() {
-            Ok(()) => Ok(Self { _file: file }),
+            Ok(()) => Ok(Self { file }),
             Err(TryLockError::WouldBlock) => Err(InstanceError::Locked),
             Err(TryLockError::Error(source)) => Err(InstanceError::Open { path, source }),
         }
+    }
+}
+
+impl Drop for InstanceLock {
+    fn drop(&mut self) {
+        let _ = self.file.unlock();
     }
 }
 
