How can I insure that if an application is not working then all the changes made to the registry is automatically deleted