fix gallery close animation bug