walletdb: Move BerkeleyDatabase::Flush(true) to Close()
Summary:
Instead of having Flush optionally shutdown the database and
environment, add a Close() function that does that.
This is a backport of core#19334 [1/4]
https://github.com/bitcoin/bitcoin/pull/19334/commits/27b27663849932971eb5deadb1f19234b9cd97ea
Test Plan: ninja all check-all
Reviewers: #bitcoin_abc, majcosta
Reviewed By: #bitcoin_abc, majcosta
Differential Revision: https://reviews.bitcoinabc.org/D10022