Revert segfault-causing netcdf changes in 0.14.x

This reintroduces gh-1550 to 0.14.x, but solves gh-3630

The other possible option is to backport the whole netdf.py to 0.14.x --- which one to take depends on how minimal changes we want in 0.14.x