use file object to prevent early GC. + Minor correction.