After reading more about the issue on Google Tracker, I now better understand the problem.
First and foremost, next time you post a question, consider adding all this information upfront, it would have helped narrow it down without you having to go back and forth for 5 days with no answer.
Now back to your problem, there's no way (that I can recall) to explicitly emulate the task swipe action you manually perform. A perhaps better workaround could be to add an intent to your app that you can send during your build, so it will "auto terminate"; now depending on what your app is, "terminating itself" may be a simple case of stopping any services, and finishing all the activities, but this may be insufficient and you'll have to play with it. Remember to make this intent filter secure and behind a feature toggle you can disable in prod if that's needed... you only want this for your eyes only ;)
If that doesn't work, I am not sure there's more you can do without resorting to hack and slash something via some script. But then again, you'd need privileges to let the Android OS let you "kill" a process; that's why I'm suggesting you try to let the process kill itself before trying something hacky and prone to fail. Alternatively, Google could "fix" the issue, but considering how long some issues are there in the tracker with "no update", I'd start considering an alternative while you can. My bet is in a few weeks a Google person will reply with "please provide a sample project with the latest AStudio", ignoring the previous 30 people who posted the same simple repro steps. Hopefully that won't be the case with your issue here. Good Luck.