fixed the count of bytes to transfer to the EOF on file expansion

The idea of this snippet is to make the buffer contiguous again. But `count` should not be `endOfLastElement - Element.HEADER_LENGTH` but `endOfLastElement - HEADER_LENGTH`.

I guess this was not detected before because it does not affect the behavior of the library, but still this is the correct way to do it.