Why outlets spark when unplugging - EMF & Inductors

likewise: and turning off an electromagnet coil powered via a transistor without snubber diodes in place can cause the transistor to explode in a fireball (and also take out damn near every other component on the circuit board...). (may have actually happened in my case).