The problem is once your app crashes, that's it. Your code isn't running anymore, and you don't have a way to clear the registry because of that.
The solution is to write your code in a manner that handles the unexpected exceptions and checks objects before trying to work with them, among other things. It's called "defensive programming."
Oh, and I'd probably move the code that deletes all of your registry data into its own method so you can call it from different places.
Aaaaaand I wouldn't use the registry at all for storing data. If you're going to store data somewhere, even temporarily, use dedicated classes, serialization, and files. Read Where Should I Store My Data?