@prudhvirajdandi Are sure, your autocloseOverlayService working properly. Did you checked for any console errors? In my point of view, You used if else statement. It always triggers else and exits. Use
console.log(suspected variable);
to print and find whats going on . I think the overlayclose service is the culprit.