Modified toArray to instead simply pass along the internal queue array rather than move its contents into a new array, which improves performance by 1.5x. As toArray is based on events, the close call needs to come *after* toArray is added, now.