Fixed file handle leak.