Hey @r4dk15.
While knocking out opponent's item, your pokemon got hurt by iron bars and fainted, it was not count as a successful knock off. That's why item was still there.
Same thing happens with rapid spin, if your pokemon use rapid spin but got hurt by opponent's item or ability, the hazard won't removed.