Add a Context parameter to checkWalletConsistency so it can be canceled when a shutdown is requested.