I was having the same problem with an animated gif. The solution is rather simple.
-
Open the Animated gif in Photoshop.
-
Go to the Window tab and select timeline(if the timeline is not already open).
-
At the bottom of the timeline panel, you will find an option, which says “Forever”.
Change that to “Once”. -
Go to File> Export> Export for Web and save it as a gif.
That should do it.