You get 1 because close is successfull.
Please have a look at $? in perlvar.
In reply to Re: exit code from FILEHANDLE object. by haoess in thread exit code from FILEHANDLE object. by Anonymous Monk