H5F_CLOSE terminates access to an HDF5 file (specified by
file_id) by flushing all data to storage.
If this is the last file identifier open for the file and no other access identifier is open (e.g., a dataset identifier, group identifier, or shared datatype identifier), the file will be fully closed and access will end.
Note the following deviation from the above-described behavior. If H5F_CLOSE is called for a file but one or more objects within the file remain open, those objects will remain accessible until they are individually closed. Thus, if the dataset
data_sample is open when H5F_CLOSE is called for the file containing it,
data_sample will remain open and accessible (including writable) until it is explicitly closed. The file will be automatically closed once all objects in the file have been closed.
Be warned, however, that there are circumstances where it is not possible to delay closing a file. For example, an MPI-IO file close is a collective call; all of the processes that opened the file must close it collectively. The file cannot be closed at some time in the future by each process in an independent fashion. Another example is that an application using an AFS token-based file access privilege may destroy its AFS token after H5F_CLOSE has returned successfully. This would make any future access to the file, or any object within it, illegal.
In such situations, applications must close all open objects in a file before calling H5F_CLOSE. It is generally recommended to do so in all cases.