We all make mistakes!
A guide to handling instances of misgendering with grace
A quick correction validates that this was clearly a verbal misstep, and not some deeper level of invalidating the person's identity.
Make it a habit. Be quick. The faster you get at correcting, the less you'll struggle with the internal complexities of "should I, or shouldn't I?" The answer is always yes, so there's no need for doubt!
Do not apologize. An apology puts the onus on the misgendered person to make the speaker feel better rather than centering the response on the feelings of the person impacted.