TODO for both close and endBlock, we currently do not handle
failures when sending the last packet. We actually do not need to
bump GS for this kind of failure. Thus counting the total number
of failures may be good enough.