Are you on CB 9.5 or latest 9.5.10 version? Cause I used to have this problem all the time, up until I installed 9.5. I have not encountered this bug at all.
I encountered it once out of about 100 times so far using Hide All Automation. That was when I had a LOT of automation lanes open. My guess is 9.5 improved the capacity Cubase can handle to close all automation at once but it still has its limit.
Just a guess. Could be totally random.