Fix for bug in HDF5 Output Layer

Reported in #750. Includes fix to the test, which wasn't catching this bug.