Fixed missing argument to factory closure

Fixed missing argument to factory closure which caused window to be null in IE11