C# state machine generator: ensuring CleanUp is only called once