Ignoring all the wiring in the switch (which I assume you have not altered), this is a common problem with LEDs and is due to induction between a line and switched live cable. The usual fix is to put a snubber (capacitor and resistor in series) across the LED.
https://uk.farnell.com/roxburgh/xe1202/rc-network-250v-0-2uf-120r-pcb/dp/2336099?st=snubber
https://uk.farnell.com/roxburgh/xe1202/rc-network-250v-0-2uf-120r-pcb/dp/2336099?st=snubber