There are various ways to end a hat, of them is in the inside, to "hide" the seam, and make the edge look seamless.
This video shows how to end a hat from the inside. Finishing on the outside or top side of the hat is similar. The first warp that you fold over should be looped so that you can weave the wefts through it at the end of the row.
https://www.youtube.com/watch?v=JCA0E2YopQc