When the target for backupwallet is the source wallet file or directory, the wallet file is cleared to zero length

### Reproduce
bitcoin-cli backupwallet ~/.bitcoin/

### Expected behaviour
Command should fail

### Actual behaviour
Wallet is destroyed.

Reported here
https://www.reddit.com/r/btc/comments/719kz3/just_lost_4bch_backing_up_my_walletdat_file/

Fix proposed in #11376 
{
    if (dbw.IsDummy()) {
        return true;
    }
    CDBEnv *env = dbw.env;
    const std::string& strFile = dbw.strFile;
    while (true) {
        {
            LOCK(env->cs_db);
            if (!env->mapFileUseCount.count(strFile) || env->mapFileUseCount[strFile] == 0) {
                
                env->CloseDb(strFile);
                env->CheckpointLSN(strFile);
                env->mapFileUseCount.erase(strFile);
                bool fSuccess = true;
                LogPrintf("CDB::Rewrite: Rewriting %s...\n", strFile);
                std::string strFileRes = strFile + ".rewrite";
                { 
                    CDB db(dbw, "r");
                    Db* pdbCopy = new Db(env->dbenv, 0);
                    int ret = pdbCopy->open(nullptr,               
                                            strFileRes.c_str(), 
                                            "main",             
                                            DB_BTREE,           
                                            DB_CREATE,