Opening two of the same wallet (tested in v0.18.0 of bitcoin-qt 64 bit) will cause a database collision, and will crash the program.

`[marshall@likon] {21:21} [~] $ bitcoin-0.18.0/bin/bitcoin-qt `
`terminate called after throwing an instance of 'std::runtime_error'  what():  BerkeleyBatch: Can't open database 8204388-wallet.dat (duplicates fileid 8b1c090000000800e25686350000000000000000 from 1352491-wallet.dat)`
`Aborted (core dumped)`

I have been able to reproduce the issue by importing two of the same wallet (with different filenames).
{
    LOCK(cs_wallet);
    WalletBatch batch(*database, "r+", fFlushOnClose);
    uint256 hash = wtxIn.GetHash();
    if (IsWalletFlagSet(WALLET_FLAG_AVOID_REUSE)) {
        
        std::set<CTxDestination> tx_destinations;
        for (const CTxIn& txin : wtxIn.tx->vin) {
            const COutPoint& op = txin.prevout;
            SetSpentKeyState(batch, op.hash, op.n, true, tx_destinations);
        }
        MarkDestinationsDirty(tx_destinations);
    }
    
    std::pair<std::map<uint256, CWalletTx>::iterator, bool> ret = mapWallet.insert(std::make_pair(hash, wtxIn));
    CWalletTx& wtx = (*ret.first).second;
    wtx.BindWallet(this);
    bool fInsertedNew = ret.second;
    if (fInsertedNew) {
        wtx.nTimeReceived = chain().getAdjustedTime();
        wtx.nOrderPos = IncOrderPosNext(&batch);
        wtx.m_it_wtxOrdered = wtxOrdered.insert(std::make_pair(wtx.nOrderPos, &wtx));
        wtx.nTimeSmart = ComputeTimeSmart(wtx);
        AddToSpends(hash);
    }