Figure 23.21 shows a vertical iron rod with a wire coil of many loops wrapped around its base. A metal ring slides over the rod and rests on the wire coil. Initially, the switch connecting the coil to a battery is open, but when it is closed, the ring flies into the air. Explain why this happens.