Upvote:1
You're taking a really close call, but if you're at the airport and you've checked in before your visa expires, you will officially be "In Transit.", even if the plane is delayed.
NOTE: Personally I would aim to leave at least 24 hours before the end of my visa, and I generally leave even earlier than that.
If you overstay your visa (even by one day) and they don't accept your excuse, you can be banned from the respective country, so leave a day early or plan accordingly.