BUG: close intermediate file descriptor in netcdf.py