You could try the following:
Move the ESC and close Excel Workbook activities outside of the Excel Scope.
Then you could add an Attach Window activity and select the Excel Window (which will give you the Application Scope) . Once you have that you could follow that up by adding the Esc key operation, followed by the Close . I tried this in Studio as I work in this mode. And it works without issues.
One way I divide these up is, I keep anything data related inside of Excel Scope. Anything else such as closing a window, is strictly not an Excel function. Rather it is a general “Windows Application” function. Therefore, I move these out into an Application Window scope.
Just to prove the point, here is a screen shot of my Excel just before I run the Flow below. The dotted line indicates I have opened Excel, Hit CTRL+A and CTRL+C to copy the entire worksheet on to the clipboard.
And then I run the flow below. The Excel will close without clipboard complaints.