Check for cancelled when starting encode
Check that we don't go and encode everything before returning failure
Check for already closed here too
Could be already succeeded. Sometimes this is harmless, sometimes it indicates we are sending inserts when we're supposed to have finished.
Check for double insert in encodeBlock()