Enter "closed" state directly when closePromise is fulfilled

Currently, state transition to the "closed" state is done by
- setting up a fulfill callback to [[closedPromise]] in the constructor
- resolving [[closedPromise]] in [[doClose]]

With this method, the state transition happens via two microtasks. This change
reduces it to just one microtask. This is required for #192 to work.

This change also cleans up unnecessary fields in the write record.