Change:
if app.__COMPARE_TOOLTIP__ and app.IsPressed(app.DIK_LSHIFT) and not slotIndex >= player.EQUIPMENT_SLOT_START and CompareItem:
self.SetCompareItem(itemVnum)
to:
if app.__COMPARE_TOOLTIP__ and app.IsPressed(app.DIK_LSHIFT) and not slotIndex >= player.EQUIPMENT_SLOT_START and CompareItem:
self.__ModelPreviewClose()
self.SetCompareItem(itemVnum)
Notice: your default button may be different, mine is left shift.