* fixes a memory leak * moves the cleanup into a FrameEndTask to avoid collisions with the trigger iterator (fixes #6747)