The following image shows the problem:
After deleting the last macro, it still remains in the SubMenu.
Crash occurs if trying to run a 'stale' macro that is left over on the menu.
The crash is caused by a command ID that is one size larger than the last valid command ID.
After applying the fix, the correct macro is executed each time, and one can proceed
to delete all the macros without any problems.