@KarthikS16730098 I think it's important to think about what you want functionally. There are OOTB methods and functions that clear threads (for example, when closing a tab or switching portals) which should be utilized as much as possible. Then there are methods like Thread-Clear that are also used in these OOTB actions, but can be leveraged in different situations. That could then be part of step 5 from Mohd.
Are there any issues preventing threads being removed where you would expect them to? Do your cases have a lot of (embedded) case data that require to do intermediate processing? Anyhow, I'm curious what the problem is and why you think this is the solution.