Due to the occured error your script doesn't finish, so thats the reason that CGI.pm is being blocked from ending the task in writing the closing tags to STDOUT. A dead chicken might keep running, an ended script not. ;-)
is correct as you had a warning and the script completes. I just didn't read further than teh cause of your error warning. :-)