Steps to reproduce:

```
$ ./src/bitcoin-wallet -datadir=/tmp  info  -wallet=asdf
Wallet info
===========
Name: 
Format: bdb
Descriptors: no
Encrypted: no
HD (hd seed available): yes
Keypool Size: 2000
Transactions: 0
Address Book: 0
```

(See the mismatching wallet name!)

Compare to:

```
$ ./src/bitcoin-wallet -datadir=/tmp  -wallet=asdf info
Wallet info
===========
Name: asdf
Format: bdb
Descriptors: no
Encrypted: no
HD (hd seed available): yes
Keypool Size: 2000
Transactions: 0
Address Book: 0

{
    LOCK(cs_dir_locks);
    dir_locks.erase((directory / lockfile_name).string());
}
void ReleaseDirectoryLocks()
{
    LOCK(cs_dir_locks);
    dir_locks.clear();
}
bool DirIsWritable(const fs::path& directory)
{
    fs::path tmpFile = directory / fs::unique_path();
    FILE* file = fsbridge::fopen(tmpFile, "a");
    if (!file) return false;
    fclose(file);
    remove(tmpFile);
    return true;
}
bool CheckDiskSpace(const fs::path& dir, uint64_t additional_bytes)