It is really hard to cover restarts in a debug, SIGKILL or power failures.
RemoveFileOnSignal takes care of crashes.
So what is left is making sure all regular exits delete the file. This patch does that by moving the buffer to error handling. That is a bit of hack, but seemed better than to generalize it to take a callback on construction.
Sending for review with just ELF. It something like this is OK I will update COFF too.