$SIG{PIPE} won't work on Windows. Windows does not implement signals, pipes, and sockets in the same way. The way CGI scripts communicate with the server is different and does not result in a SIGPIPE when the communications is disconnected.
I don't see the problem if the script finishes normally even if the client disconnects. Can't it delete the temporary file in its normal cleanup? Special code is only needed when the disconnect causes the CGI scripts to be killed before it is done and not run the END code.