Production of lithium-ion batteries safely