avoid opening and closing HDF5 files multiple times during output

Create issue
Issue #2364 open
Roland Haas created an issue

Reduce file system open/close calls from once per variable per reflevel per iteration of output to once per variable per iteration of output or less (if one_file_per_group or one_file_per_proc is used).

It does however keep more files open which can be an issue if the OS limit on open files is too small. Usually this limit is per process though and as long as one process does not open many files, the whole simulation can still open very many.