6.8.5CLOSE FILE
Syntax
CLOSE FILE [file_name [, file_name]*]
Description
Close the HDF5 file currently in use or a certain HDF5 file in use (i.e. opened). Multiple files can be closed at once by separating their names with a comma (,). If no file is currently in use or file_name is not in use (i.e. opened) or it is not possible to close it (due to unknown/unexpected reasons), no subsequent files are closed, and an error is raised. Before closing a file, all buffered data will be written into it. After closing a file, the file most recently in use before the closed file will become the file in use.
Parameter(s)
file_name – optional string that specifies the name of the HDF5 file to close. If file_name is specified, it will be closed regardless of whether it is the file currently in use or not. If not specified, the file currently in use will be closed. Of note, if file_name is specified, it must match exactly the name of the file when it was opened (otherwise no file will be closed and an error is raised).
Return
Nothing
Example(s)
# use (i.e. open) four HDF5 files named "my_file0.h5", "my_file1.h5", "my_file2.h5", and "my_file3.h5"
USE FILE my_file0.h5, my_file1.h5, my_file2.h5, my_file3.h5
# show (i.e. get) HDF5 file currently in use (i.e. open) (should return "my_file3.h5")
SHOW USE FILE
# close HDF5 file currently in use (i.e. file "my_file3.h5")
CLOSE FILE
# show (i.e. get) HDF5 file currently in use (i.e. open) (should return "my_file2.h5")
SHOW USE FILE
# close HDF5 file "my_file1.h5"
CLOSE FILE my_file1.h5
# show (i.e. get) HDF5 file currently in use (i.e. open) (should return "my_file2.h5")
SHOW USE FILE
# close HDF5 file currently in use (i.e. file "my_file2.h5")
CLOSE FILE
# show (i.e. get) HDF5 file currently in use (i.e. open) (should return "my_file0.h5")
SHOW USE FILE
# close HDF5 file currently in use (i.e. file "my_file0.h5")
CLOSE FILE
# show (i.e. get) HDF5 file currently in use (i.e. open) (should return nothing)
SHOW USE FILE