Add additional Error Check when writing attribute matrix

Added an additional check for an error when writing the attribute
matrix to the HDF5 file.