Is it necessary to protect the lifetime of objects inside a closure

The following code will create 2 clients and connects to the server. The life time of socket variable is expected to live till the end of the program. Although the code works fine, just wondering, Is it necessary to add the socket variable inside the closure to an array or some container outside the closure in order to protect the lifetime of the socket.

var usernames = [];
usernames.push('tom');
usernames.push('bob');

usernames.forEach(function (username) {

    var socket = require('socket.io-client')('http://localhost:3000', {'forceNew': true});

    socket.emit('loaded', {username: username});
}

from the spec:

A WebSocket object whose readyState attribute's value was set to CONNECTING (0) as of the last time the event loop started executing a task must not be garbage collected if there are any event listeners registered for open events, message events, error events, or close events.

A WebSocket object whose readyState attribute's value was set to OPEN (1) or CLOSING (2) as of the last time the event loop started executing a task must not be garbage collected if there are any event listeners registered for message events, error events, or close events.

A WebSocket object with an established connection that has data queued to be transmitted to the network must not be garbage collected. [WSP]

If a WebSocket object is garbage collected while its connection is still open, the user agent must close the WebSocket connection. [WSP]