Why renaming a running executable can fail

I always thought that it is not possible to rename an executable that is currently running. Turns out I was wrong (happened before). It works fine for many executables, but not for all of them. In particular it does not work for the executables of our internal tools. Windows complains that the file is in use can cannot be renamed.

Prompted by this thread in the international Delphi Praxis forum, I just did some digging and it turns out that it’s DxGettext that keeps that file open when the translations are bound to the executable file using the assemble tool.