Set readyState to CLOSED as soon as finalize() is called to prevent reentrant calls from events this method emits.