Exit with cleanup for all cases