Type mismatch in argument 'file_id' at (1); passed INTEGER(4) to INTEGER(8)

You have some kind of argument mismatch in the call to hfdwrite_f. This kind of error is discussed in more detail in the recent forum topic Errors compiling code with h5dread_f.

Please note the suggestion to use the F2003 interface, which handles type variations more easily.