if the macro is stopped while the logfile is Open, then it will be locked for editing. So you will need to tell it to close.
Normally one would do this at the start of the macro, i.e. issue a Close command (no parameters). This should close any file left open from a prior run.
Then you can use a timestamp in your logfile name.
To minimise the likely hood of the logfile being open when you manually stop the macro you can try to reduce the number of times that you write to the log and always close and reopen the log file before and after each write to it.
So the first time you open a file you open it for Output, then before subsequent writes you open it for Append.
Ideally you should create a small subroutine to handle logging.
e.g. AppedToLogfile(MyMessage as String)
Then in this subroutine you open for append, write to the logfile and close it.
In your main routine you would then open for Output and Close it, subsequently you'd simple call AppendToLogfile and pass the string you which to write into the logfile.