create closures in js files