I want to show you a tip for finishing the top of the sock.
Pull it through and take your needle to the back and insert it through the last cast on stitch from back to front.
Take the needle to the back and insert through the back of a stitch to secure. You may find that by sewing through the first cast on stitch twice you get a small hole. Thread your needle across this small hole and it will close.
Now thread the needle down one leg of a knit column of stitches of the ribbing and cut it off, you're done.
You now have a lovely even edge to your cast on.