Quenching of lanthanide emission by intervalence charge transfer in crystals containing closed shell transition metal ions