Maybe MC re-importing the file after Mp3Tag changes it, is what's causing the issue?
Perhaps Mp3Tag is writing some tag with a filename (TOFN?) and MC is checking if it has a valid folder path... @Matt?
It doesn't seem related to the code you pasted above - that seems to be creating a random filename, where here the filename has a fixed prefix and a .tmp extension. It looks like a test to determine if a folder is writable.