I looked this up in my Knitter's Book of Finishing Techniques. She says that the 'original' way of making a buttonhole leaves a small gap at the right end.
This is her revised way:
Cast on three more stitches than you bound off. Turn the work. Slip the first stitch on the left needle over to the right needle and pass the extra cast-on stitch on the right needle over to close the buttonhole. Finish the row. On the next row, work to one stitch before the cast-on stitches of the buttonhole, purl two together if the stitch is to be a purl, or knit two together if it is to be a knit, work to last stitch of cast-on stitches and work slip, slip, purl if stitch is to be a purl, or slip, slip, knit if stitch is to be a knit. finish row. The extra step of knitting or purling the stitches together at the beginning and end of the cast-on stitches helps to close up the gaps and clean up the corners of the buttonhole.