It does sound like it could likely be an electrical problem. I had a mini cooper with a bad ground wire on the battery do the same thing. Also, I had a bad crank position sensor in my STI once and it would cut out, shudder, and sometimes just die the instant it hit 4k rpm. If the battery connections aren't the issue, I'd take it in for warranty repair. Good luck!
Bringing it to the dealer is my next option. The bike ran fine today.
I did speak with someone today and he said it could be the flap that opens and closes in the exhaust. He said they can malfunction. His fix was to get a slip-on exhaust and that would eliminate the sensor. If only I had exhaust money right now