i haven't had a broken file for a long time... so i'm wondering what you are doing differently.
in the past, what i've learned to do was: if you get a strange state when undoing, just close the file without saving it.
and redo what i had lost.
(a better way, could be to do a copy of the .sla in the filemanager before saving and then save... if you're lucky the save process worked well... if not you have the copy which should be the same as if you did not save at all...)