unregister instance before exit