Does the headlight stay on or does it go dark when the loco stops? What type and what manufacturer are the switches where the loco stalls? Does the loco stop with the wheels on the frog?
The fact that the headlight goes out when the loco stops means that the loco is not getting power or is making a short. Using a test light ( I use old light boards that I have replaced with decoders ) test the switch with the route that the loco stalls on set up to see if you have power through the entire route over the switch. Also look at the frog where the two rails leave the frog and see how close those rails are. The wheels may be bridging this point causing a short. The faster you go the loco will get past this spot. you may have to use a little paint or nailpolish at this point to extend the insulation. I have to do this with my Peco and Atlas turnouts.