You may think your code is fine, and it may even work, but how could you know there are no horrible blunders under the hood, waiting for the next version of Windows to awaken like a hung over Chthulhu pissed at noisy neighbors?
Well, porting your project to Linux is one way to ensure there are no such horrors lying in wait.

In this particular case, I was calling TCriticalSection.Leave twice. Windows swallowed it. Linux...? Bam! EInOutError.

Even if you can't/won't port to Linux, there is wine . Many instances of crap code that manage to work in real Windows (which is too too forgiving) crash and burn when launched in wine. Critical sections are one example, yes.

I learned all of that the hard way, heh.