I had a problem similar to that, my bike was restarting while driving and sometimes was dying too.It turn out to be the ignition switch,when you unscrew the switch from the frame there are two more screws that holds the switch,on my bike they were to short and the switch was loose,after replacement everything was fine.