2013 E4 shutting off intermitently

Hey Guys, I have a 2013 E4 that I recently purchased, only like 3500 miles on it. Lately it’s been just shutting off for no apparent reason in the middle of driving or on a turn. It will just start with a continuous beep and the wrench on the panel lights up. I’ll pull to the side, shut of the main breaker, key switch and pull up the e-brake. Then i start with turning the main breaker on and off a few times, sometimes it will start with the long beep as soon as the breaker is on. Eventually it stops with beep and will resume working as it should. Some days it doesn’t do it at all and some days it will do it 4 or 5 times each day. Not a battery issue, brand new gels a month ago, once it’s back on it works like it should. Any advice would be welcomed. Thanks in advance.

You most likely have a bad key switch.

Someone else said the same thing. I suspected maybe the switch for the e brake might be an issue but I’ll try a new key switch. Thanks for your help