Stop the gif at the right time