and I’ve got to the end after all the decreases (this hat is knit flat) and now the pattern says
“Break yarn, leaving a 12” (30.5 cm) tail. Thread tail through rem sts, pull tight to gather sts, and fasten off inside.
With MC threaded on a tapestry needle and beg at gathered top, sew seam using mattress stitch or backstitch (see box), reversing seam for lower 3⁄4" (2 cm) for rolled brim"
I am confused because it doesn’t tell me anywhere to cast off! Do I cast off before or after the gathering?
I am not familiar with this technique of gathering and then ‘fastening off inside’