Do the cleanup properly.