replaced $fh->close with close $fh for older perls