To finish the beanie, invisible fasten off:
Then flip the last two rounds up to make a rim around the beanie, and weave in the yarn tails to make sure your beanie won't unravel: