This problem has absolutely nothing to do with Perl.
It's a matter of communication between your program and
your web server. It's your web server that needs to think
the program has finished. If your web server does that
why watching for eof on stdout and stderr, you need to
close them. Don't forget than on a fork(), filedescriptors
get dupped.
Did you know this issue if even pointed out in perldoc -f fork?
Abigail