The only solution I've found for that is to save your work as you're writing. That leads to what can be a significant number of corrections indicated in your post as you go, but... at least you don't lose everything.