avio: Keep track of the amount of data written