fix window obj handling in closure for browserify compat