eventsource: fix crash when calling close() in closed state