The clean-up flow is defined in the Flow Properties dialog box's Cleanup recovery flow property.
The clean-up flow is called before the flow is aborted or restarted, which is defined in the flow's Recovery policy.