Hi Slavoko,
If your problem is hit because of memory usage keep increasing due to Task queue keep trying(in success case does not have memory problem), then maybe you can set up error handling for microflow, in term of validation and prevent run time error, so your microflow will end properly.
this documentation should help you:
https://docs.mendix.com/refguide/error-handling-in-microflows/#222-error-handling-which-ends-with-an-end-event