You need to set this null inside the FrameEndTask. It currently sets this null immediately, which then causes w.Remove(null) to throw an exception.