That is probably a Windows virus that won't affect the Mac at all. I find those in emails every once in a while, usually from either a spammer or someone who isn't careful at all about where they go or what they click on and are using Windows.
Recent items is a new Dock function that is controllable in System Preferences/Dock & Menu bar. Just remove the tick from the box labelled "Show Recent applications in Dock."
What happens if you don't close the lid? Just leave the lid open and either click on the in the upper left corner and then "Sleep," or open System Preferences, and then "Power saving" or "Battery" depending on what version of macOS you are running, then set the screen to darken after whatever period of time you want (I use 15 minutes on external power, 5 on battery), then just leave the screen open and walk away. After the set time, the screen will go dark, the machine will go to sleep.
I'm baffled by the idea that a closed application can open on its own and actually execute actions without some external actor in play. Do you have a password on your system and is it active? By that I mean you have NOT turned on Automate Login in System Preferences/Users & Groups under your login? And are you near enough to any neighbor that they might be connecting to your machine remotely by WiFi and/or Bluetooth? I wonder if not using your password on wake up of the Mac, coupled with someone connecting remotely is allowing someone to "play" with your system. Having an active password and NOT using Automatic Login is the way to stymie such mischief. That is a really long shot, but easy to prevent it happening.