Wish they have an edit button to edit a post if I want to add.
So typically the "close" sign you read as a customer is the "door close" time, let's say 10 pm. It means by 10 pm, they will not accept any new customers. If you make it 10 mins before the door close time, the kitchen is still open. This time is set as the "last minute" they can allow new customers, but not actually when they close.
Typically in most restaurants the kitchen will remain open for an additional 10-20 mins, usually 15 mins. This again, doesn't mean the kitchen will actually shut down in that time, it means you have that much time to "order." It will shut down after receiving the final order at the end of the kitchen time.
So you get in at 9:50 pm, you are at least 20-30 mins before the kitchen close time. They'll usually rush you to order, so say you order within 2 mins, the kitchen takes 10 mins to make your meal, you start eating at 10:02 pm, which is still well within the kitchen time.
After the kitchen closing time, the staff starts clean up, the dining room, the kitchen, and the manager start doing "accounting" for the day. This is why they often ask you to pay first before your meal comes if you are that late into the night. So while you eat, they clean up and do their accounting.
Let's say the latest scenario with a kitchen closing time at 10:20pm. You order at 10:18pm, it takes them 10 mins to cook your meal. They close the kitchen at 10:28 pm. The would have already asked you to pay the bill, then give you 30 mins to eat your meal. They would close roughly around shortly after 11pm, probably 11:30 to be realistic. Which is very normal.