Why did my headlights kill my car?

Years ago, I had to drive my 64 340 Dart from Woodburn(OR) All Mopar drags to tri cities Washington for the hydroplane races, and my H4 headlights started to overheat my headlight switch and my headlights would turn off while doing 70mph. Not fun. So I pulled the switch from my dash and let it hang down in the vent air coming from the vent box on the driver side foot well. It worked to keep my headlights on and me driving the rest of the way without playing peek-a-boo with dark roads at freeway speeds. Not a permanent fix, but it worked for me.