Is it possible to use Recent Apps to close all open apps less the one I want to stay open? I have a scenario, or many, where I end up opening a ton of apps, and later on want to close them all at once, but keep 1 or 2 open. As an example, I use WhatsApp at home, and as we all know you cannot use the web portal without the app on your phone being on. So ideally I would have wanted to be able to use the Recent Apps feature of Android to close all apps, less say those selected as 'keep on.' And then if I really wanted to close them, I could then go into Recent Apps and manually close them.
Is there perhaps an app would allow me to script such a task, or any other solution?
I'm running Android 10 on a Galaxy A71 5G
Thanks in advance.
From the recent apps panel, select the app you want to lock, for example Chrome.

Press the 3 dots menu (above the Chrome panel) to show the lock option. Lock it.

and the small lock symbol shows up.

Now the app is locked and cannot be swiped away to dismiss the app. To unlock follow similar steps. You can clear unwanted apps by manually swiping away.
Alternatively, you can use apps such as Kill Apps, which allow you to customize the list of apps to be killed. Such apps are not usually recommended as Android manages memory space efficiently and such task killers can cause more harm by abruptly killing running apps.
See Recents Screen-Android Developers for more information.