Added promise to hideElementWithTransition

So that overlay close animation is working properly