I agree with @reptilicus that your best bet is to close the files you aren't actively using if possible. But if you really must, you can use the ulimit command to increase the number of open files available to your process - see this answer for details
Edit:
You can use context management to ensure the file is closed even if an error occurs:
with h5py.File(file, 'r') as curh5file:
... # Do your stuff
... # continue other actions
When you exit the "with" block, the file will be automatically closed. If an exception happens, it will still be closed.