If the battery is cutting out with 40v registering then there is an issue as mentioned with battery. It would need an expert or someone with the diy knowledge to be able to check for the issue with the battery.
It can be one of several factors , battery age , balance and cell quality, a balance...