[wallet] Fix leak in CDB constructor
Summary:
Now using a std::unique_ptr, the Db instance is correctly released
when CDB initialization fails.
The internal CDB state and mapFileUseCount are only mutated when
the CDB initialization succeeds.
Backport of core PR11492
Complete T220
Test Plan:
make check
Reviewers: #bitcoin_abc, deadalnix, jasonbcox
Reviewed By: #bitcoin_abc, jasonbcox
Subscribers: teamcity, schancel
Differential Revision: https://reviews.bitcoinabc.org/D2231