Yes, you can go out of the airport only if you have a visa (if necessary) and go through customs and immigration processes on your way out and again on your way in.