[wallet] Close DB on error.
[wallet] Close DB on error.

Github-Pull: #11017
Rebased-From: 03bc719a85cb4928cb4b43d0bc4142f72cb01b23

digibyte/digibyte,gjhiggins/vcoincore,GroestlCoin/GroestlCoin,BitzenyCoreDevelopers/bitzeny,GroestlCoin/bitcoin,particl/particl-core,romanornr/viacoin,gjhiggins/vcoincore,GroestlCoin/bitcoin,UFOCoins/ufo,Anfauglith/iop-hd,BitzenyCoreDevelopers/bitzeny,digibyte/digibyte,qtumproject/qtum,Jcing95/iop-hd,GroestlCoin/GroestlCoin,UFOCoins/ufo,romanornr/viacoin,wangxinxi/litecoin,digibyte/digibyte,tecnovert/particl-core,GroestlCoin/GroestlCoin,Jcing95/iop-hd,Anfauglith/iop-hd,wangxinxi/litecoin,wangxinxi/litecoin,tecnovert/particl-core,particl/particl-core,GroestlCoin/GroestlCoin,UFOCoins/ufo,tecnovert/particl-core,qtumproject/qtum,wangxinxi/litecoin,BitzenyCoreDevelopers/bitzeny,gjhiggins/vcoincore,GroestlCoin/GroestlCoin,BitzenyCoreDevelopers/bitzeny,Anfauglith/iop-hd,qtumproject/qtum,wangxinxi/litecoin,qtumproject/qtum,romanornr/viacoin,tecnovert/particl-core,gjhiggins/vcoincore,particl/particl-core,UFOCoins/ufo,Jcing95/iop-hd,particl/particl-core,Jcing95/iop-hd,tecnovert/particl-core,UFOCoins/ufo,qtumproject/qtum,particl/particl-core,GroestlCoin/bitcoin,GroestlCoin/GroestlCoin,GroestlCoin/bitcoin,UFOCoins/ufo,GroestlCoin/bitcoin,qtumproject/qtum,BitzenyCoreDevelopers/bitzeny,particl/particl-core,wangxinxi/litecoin,romanornr/viacoin,qtumproject/qtum,digibyte/digibyte,tecnovert/particl-core,Jcing95/iop-hd,BitzenyCoreDevelopers/bitzeny,Jcing95/iop-hd,Anfauglith/iop-hd,Anfauglith/iop-hd,romanornr/viacoin,Anfauglith/iop-hd,romanornr/viacoin,digibyte/digibyte,digibyte/digibyte,gjhiggins/vcoincore,GroestlCoin/bitcoin,gjhiggins/vcoincore