The role of arcing in producing metal impurities in tokamaks