Promise resolution after close animation

This change moves the result promise resolution to after the close animation is finished.