Game froze then force closed when trying to cast spell

About every couple hundred battles when I am rapidly pressing E to cast spells, the spell selection screen closes, but not the text saying “Select a spell for your __ to cast”.

The game never casts the spell and eventually Windows closes the game for not responding. A screenshot could not be taken due to the program freezing.

2.3.2
Win 10