Avoid registering exit cleanups multiple times