Cancel patching gracefully when exiting