On master, reported on IRC, appveyor and travis (macos):

Example backtrace:

```
wallet_multiwallet.py --usecli failed, Duration: 56 s
stdout:
2018-12-10T19:52:57.293000Z TestFramework (INFO): Initializing test directory C:\Users\appveyor\AppData\Local\Temp\1\test_runner_20181210_194416\wallet_multiwallet_70
2018-12-10T19:53:18.569000Z TestFramework (INFO): Do not allow -zapwallettxes with multiwallet
2018-12-10T19:53:19.332000Z TestFramework (INFO): Do not allow -salvagewallet with multiwallet
2018-12-10T19:53:19.839000Z TestFramework (INFO): Do not allow -upgradewallet with multiwallet
2018-12-10T19:53:32.857000Z TestFramework (INFO): Check for per-wallet settxfee call
2018-12-10T19:53:33.296000Z TestFramework (INFO): Test dynamic wallet loading
2018-12-10T19:53:36.907000Z TestFramework (INFO): Load first wallet
2018-12-10T19:53:37.476000Z TestFramework (INFO): Load second wallet
2018-12-10T19:53:38.049000Z TestFramework (INFO): Load remaining wallets
2018-12-10T19:53:41.485000Z TestFramework (INFO): Test dynamic wallet creation.
2018-12-10T19:53:43.012000Z TestFramework (INFO): Test dynamic wallet unloading
2018-12-10T19:53:47.773000Z TestFramework (INFO): Test wallet backup
2018-12-10T19:53:52.517000Z TestFramework (ERROR): JSONRPC error
Traceback (most recent call last):
  File "C:\projects\bitcoin\test\functional\test_framework\test_framework.py", line 173, in main
    self.run_test()
  File "C:\projects\bitcoin/test/functional/wallet_multiwallet.py", line 315, in run_test
    self.nodes[0].loadwallet(wallet_name)
  File "C:\projects\bitcoin\test\functional\test_framework\test_node.py", line 400, in __call__
    return self.cli.send_cli(self.command, *args, **kwargs)
  File "C:\projects\bitcoin\test\functional\test_framework\test_node.py", line 453, in send_cli
    raise JSONRPCException(dict(code=int(code), message=message))
test_framework.authproxy.JSONRPCException: Wallet file verification failed: Error loading wallet w2. Duplicate -wallet filename specified. (-4)
else
            ++it;
    }
    
    
    if (coin_control.m_avoid_partial_spends && vCoins.size() > OUTPUT_GROUP_MAX_ENTRIES) {
        
        
        
        Shuffle(vCoins.begin(), vCoins.end(), FastRandomContext());
    }
    std::vector<OutputGroup> groups = GroupOutputs(vCoins, !coin_control.m_avoid_partial_spends);
    size_t max_ancestors = (size_t)std::max<int64_t>(1, gArgs.GetArg("-limitancestorcount", DEFAULT_ANCESTOR_LIMIT));
    size_t max_descendants = (size_t)std::max<int64_t>(1, gArgs.GetArg("-limitdescendantcount", DEFAULT_DESCENDANT_LIMIT));
    bool fRejectLongChains = gArgs.GetBoolArg("-walletrejectlongchains", DEFAULT_WALLET_REJECT_LONG_CHAINS);
    bool res = nTargetValue <= nValueFromPresetInputs ||
        SelectCoinsMinConf(nTargetValue - nValueFromPresetInputs, CoinEligibilityFilter(1, 6, 0), groups, setCoinsRet, nValueRet, coin_selection_params, bnb_used) ||
        SelectCoinsMinConf(nTargetValue - nValueFromPresetInputs, CoinEligibilityFilter(1, 1, 0), groups, setCoinsRet, nValueRet, coin_selection_params, bnb_used) ||
        (m_spend_zero_conf_change && SelectCoinsMinConf(nTargetValue - nValueFromPresetInputs, CoinEligibilityFilter(0, 1, 2), groups, setCoinsRet, nValueRet, coin_selection_params, bnb_used)) ||
        (m_spend_zero_conf_change && SelectCoinsMinConf(nTargetValue - nValueFromPresetInputs, CoinEligibilityFilter(0, 1, std::min((size_t)4, max_ancestors/3), std::min((size_t)4, max_descendants/3)), groups, setCoinsRet, nValueRet, coin_selection_params, bnb_used)) ||
        (m_spend_zero_conf_change && SelectCoinsMinConf(nTargetValue - nValueFromPresetInputs, CoinEligibilityFilter(0, 1, max_ancestors/2, max_descendants/2), groups, setCoinsRet, nValueRet, coin_selection_params, bnb_used)) ||
        (m_spend_zero_conf_change && SelectCoinsMinConf(nTargetValue - nValueFromPresetInputs, CoinEligibilityFilter(0, 1, max_ancestors-1, max_descendants-1), groups, setCoinsRet, nValueRet, coin_selection_params, bnb_used)) ||
        (m_spend_zero_conf_change && !fRejectLongChains && SelectCoinsMinConf(nTargetValue - nValueFromPresetInputs, CoinEligibilityFilter(0, 1, std::numeric_limits<uint64_t>::max()), groups, setCoinsRet, nValueRet, coin_selection_params, bnb_used));
    
    util::insert(setCoinsRet, setPresetCoins);
    
    nValueRet += nValueFromPresetInputs;
    return res;
}
bool CWallet::SignTransaction(CMutableTransaction &tx)