[WIP] Data from netcdf variable is invalid after file close.

On the current master (actually since 2dfffc7beeb924d6aa5e6529f25745c5330a7bac) the following code segfaults.

```
with open('my-netcdf-file', 'r') as f:
    x = f.variables['varname'][:]
print x.sum()
```

cc #3630
The difficulty with this bug is that I think it requires some garbage collection to occur first. I don't know why that would be the case, though. Should we double-check this test on Travis by taking out the fix and seeing if the test fails?