Fixing date directive not dismissing previous popups correctly