require that write() cannot happen after done(), and validate the number of bytes if known