Both issues of being unable to open files during runtime and corrupted files when aborting the program can be fixed by adding H5Fflush(hdf5_fp, H5F_SCOPE_GLOBAL); before the close functions.
H5Fflush(hdf5_fp, H5F_SCOPE_GLOBAL);