I’ve noticed the same problems using buttons on large data sets as mentioned here
It’s a rather consistent problem although I never know what size is safe to operate on in one action. I’ve found scripting to be the best bet for more than 4000 records.