Closure in JavaScript advantages and disadvantages