Open the file for update before opening the file for read

HDF5 doesn't like you opening a file for read and then opening the
same file for update.