Add sanity check to EnvelopeWriter which requires envelope to contain at least a buffer or an event