fname is a bit confusing because this is expected to be an open file, not a filename. We typically name variables <something>_f if it is a file handle, and <something>_fp if it is a filepath (i.e. string). I recommend updating the name here to be something like biom_f to indicate that this is an open file handle to a BIOM file.