close file connection

Thanks @yihui