Honestly, I don't think people know exactly what your question is. What .tmp file? What "obligatory" blue screen? Why or when is the file locked? And by what program?
There are a lot of smart people here, but the poster that gets an answer is the poster that writes out the specific details of what is happening and what is desired.