BUG: io.netcdf: do not close mmap if there are references left to it

Fixes segfaults when using arrays referring to a closed memmapped netcdf_file, by detecting whether the memmap is still in use.

The 0.14.x branch will need a slightly different fix as the code there is different.

Supercedes gh-3633
Fixes gh-3630