core: Fix invalid read when removing device while in GATT discovery