so unplug the headlights at the headlight unit one at a time and test by turning the switch on.
see if it only does it with one etc. you appear to be a sparky, use your head
if it still stalls with both headlights unplugged, its somewhere in the switch or the loom.
when they automatically turn on, does it stall too? if not, its not the headlights, its probably the switch. i have a spare if you think thats what it is