Discharging an inductor
I find it helpful to think of capacitors and inductors to be complimentary.







simulate this circuit &ndash; Schematic created using CircuitLab

Figure 1. Ideal and imperfect components.


Capacitors store energy in an electric field. Inductors store energy in a magnetic field.
A capacitor holds energy when open circuit. An inductor holds energy when short circuited.
Capacitors lose energy through parallel leakage resistance. Inductors lose energy through series resistance.
Capacitors "like" to keep the voltage across them constant. Inductors like to keep the current through them constant.
When a capacitor is short circuited the resultant current is very high. When an inductor is open-circuited the resultant voltage is very high.



  ... when an inductor is disconnected the magnetic field starts collapsing inducing a very high voltage, wouldn't this voltage breaks down any transistors used in the switching from the charging to the discharging circuit?


Yes it would but there's a simple solution:



Figure 2. A simple buck converter. Source: All About Circuits.

In Figure 2 S is the transistor switch similar to that mentioned in your question. When it is switched the inductor tends to maintain current in the direction of I. Since the right side of L is "held" by C and current is to keep going then the left side of L goes negative to try to maintain current. Whe the voltage reaches -0.7 V D starts to conduct and maintains the current through L keeping it "happy" and avoiding a transient high voltage.

You will see this arrangement more commonly in snubber diodes on relay coils.







simulate this circuit

Figure 3. A typical relay control circuit. Without D1 the inductance of the relay coil would generate a large negative voltage on switch off. This would be likely to destroy Q1 . The diode limits the negative excursion on Q1 collector to -0.7 V.