Typically the ```setId``` method is used for writing the header; while not strictly necessary, you may wish to consider moving the header writing from ```openBytes``` to here.