Macro that won't close the window?

Hello,
I want to create macros that close the current message window and opens the next--or previous--one in my email application (MailMate for Mac).

I created 2 macros that close the open message (Cmd-W), highlights the next or precious one (hot key is up key or down key) then opens it. This works.

The problem comes when there is no message open, only the viewer window showing all the messages. When I accidentally execute either of these macros, the first step (Cmd-W) closes the viewer window!

Any ideas how I might write this macro so as to not close the viewer window? Can I first test that a message is open?

Thanks,
Dave
MacOS 10.14.2 Mojave
Keyboard Macro 7.3.1
MailMate

Never mind. I found that the MailMate app already has Previous Message and Next Message hot keys. I just overlooked these and thought I needed a macro.

It's called "Macro vision"; always thinking the solution is a macro. (c;

Dave