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 (ret2 > 0)
                                fSuccess = false;
                        }
                    if (fSuccess) {
                        db.Close();
                        env->CloseDb(strFile);
                        if (pdbCopy->close(0))
                            fSuccess = false;
                    } else {
                        pdbCopy->close(0);
                    }
                    delete pdbCopy;
                }
                if (fSuccess) {
                    Db dbA(env->dbenv, 0);
                    if (dbA.remove(strFile.c_str(), nullptr, 0))
                        fSuccess = false;
                    Db dbB(env->dbenv, 0);
                    if (dbB.rename(strFileRes.c_str(), nullptr, strFile.c_str(), 0))
                        fSuccess = false;
                }
                if (!fSuccess)
                    LogPrintf("CDB::Rewrite: Failed to rewrite database file %s\n", strFileRes);
                return fSuccess;
            }
        }
        MilliSleep(100);
    }
}
void CDBEnv::Flush(bool fShutdown)