The Taliban have said that they had destroyed an Islamic State cell in the Afghan capital, hours after a suspected IS attack on a mosque killed five people.