[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