As klystron says, but if you have a simple switch, switching off causes the current to fall to zero quickly, so as the magnetic field collapses, it generates a huge voltage spike that will flash across the switch contacts as they open. This is why switches/relays/contacters and transistors need to be a bit special if they are called to deal with current switching in inductive circuits. The energy stored in the magnetic field is 1/2 X I^2 X L and this energy has to dissipated somewhere, mainly as heat in the arc at the switch contacts.
Frank