Stopped blocking the event loop when trying to close