Not likely the motor brake, as that would shut the cart down altogether. Sounds like the motor speed encoder, or maybe the motor temperature sensor. Since it coincides with battery replacement, check all of the harness connectors where they connect from the motor to the main harness, behind the rear battery. Unplug/replug each of them a few times to wipe the connections.