If unplugging it and plugging back in helped the situation, then there’s a good chance the issue could be at or near the plug that you were handling. Check for any moisture or corrosion inside that plug. Check all of the female terminals and see if any of them look looser than the rest. If it is running, wiggle test the harness near the plug and see if that makes the problem come back. Check every ground connection you can find. If one of them is even the slightest bit loose or dirty, it can cause all kinds of issues.
Next time it does this, you might also try disconnecting the battery ground and then reconnecting it to see if it resets something with the computer.