The phrase "main menu" is nowhere in the code. Are you sure that's exactly what it says?
I'm guessing it says "menu main", which is the command that gets executed when you go into the main menu. My guess is that upon initialization, the buffers in the autoexec got executed, then the menu command got sent, but got tagged onto the last line of the autoexec.cfg. If you put a newline at the end of the last line in your config, it should fix the problem. I'll add something in the code that inserts an extra newline after executing a config file as well.