Investing 101: When an option expires at its strike price, what happens?

I had a covered call position with QQQ opened a few weeks ago with a strike price of $480. For most of the time it was out of the money but last week the stock jumped to the mid $470's so I decided to buy back to close a few days before the expiry date, which is today. I pocketed a couple hundred dollars by closing my position early but gave up some money since the option still had time value.