Badger acquires an exclusive lock on the directory to prevent multiple processes from using it. The existing code in dir_windows.go file relies on an in-memory handle to prevent multiple files from accessing it.
While opening we set the sharing mode to zero which means only one process can access it
From Create File Documentation
If this parameter is zero and CreateFile succeeds, the file or device cannot be shared and cannot be opened again until the handle to the file or device is closed. For more information, see the Remarks section.