fix alternating closing issue

@myabc do we have a scope in that ... scope? or do you mean $rootScope.$apply?