What happens when you switch off the voltage of a transformer

An ignition system consists of two solenoids. The primary circuit consists of the first solenoid connected via a switch to the car battery. The secondary solenoid is wound on top of the primary solenoid and is connected to the spark plugs. If the switch is closed, an emf will be induced on the second solenoid, which amplifies the car battery's voltage. The question is what happens when the switch is open and suggest a useful practical modification to the primary circuit.

My argument is that when the switch opens, the voltage supplied to solenoid 1 drops to 0 hence by Lenz's law, an opposite current flows through it and hence would still induce a voltage to solenoid 2. But in terms of modification, I am not really sure, would a diode in circuit 1 prevent the Lenz current?

When a switch opens, a current drops to zero, but not a voltage. The voltage across the switch is known to be zero only when the switch is closed.

The automobile spark coil has switch, battery, and primary (solenoid) winding which are in series. When the switch is closed, the battery is in series with the solenoid (and maybe a ballast resistor, but that's a minor detail). That puts a voltage across the solenoid, which causes a rising electric current. At this time, the secondary (solenoid #2) carries no current, but that is about to change. The primary current magnetizes the iron core of the 'transformer' which is the spark coil. Magnetization of the iron stores up energy, just as charge in a battery does.

When the switch is opened, the CURRENT in the primary winding goes to zero, and the magnetized iron in the coil starts to demagnetize. Magnetization rising caused about +12V across the primary, and magnetization dropping causes about -12... then -120... then -300V on the primary. Meanwhile, the secondary is just as much an induction winding on the core as the primary was, and it gets its own (rather higher) voltage, up to -40,000 V, because it has more turns around the core (of finer wire) than the primary did.

Then another switch closes. The 'other switch' is the least-insulated metal-to-ground part of the secondary circuit, and it only closes in the sense that it ceases to block current. There's now a small lightning-bolt, and a conductive blob of ionized gas, in a small gap between the spark plug electrodes.

Now, the voltage on the secondary drops as the current flows in the direction that demagnetizes that iron core, and when there's no longer enough voltage to keep the gap filled with ionized (conducting) gas, the spark winks out.

would a diode in circuit 1 prevent the Lenz current?

Yes, a diode in the primary circuit WOULD prevent the spark current, by being a switch that closes at much lower voltage (about -1V on the primary, when perhaps 130V is across the secondary). The diode could be either across the primary of the coil, or from the primary to the battery (i.e. across the switch); the battery voltage is only a small difference from ground.

With the diode acting as clamp, the primary voltage swings from +12V to -1V, the secondary ranges from +1500 to -130, and the spark plug doesn't fire. Without the diode, the secondary would see +1500 to -40,000V, and a spark is born.