currentWritePromise must be cleared in [[error]]

Also fixes a bug in the reference implementation:
Resolver and rejecter for closedPromise must be included in the record