Does that mean you want to keep tables open if they have zero rows? Not sure how to do that without a script, but generally if I want to close all my tables then I go to one of my tables and from the menu select Window>Close All Data Tables.
There exist multiple previous discussions on this. But, here is a simple piece of code that will do what you want:
Names Default To Here( 1 );
For( i = N Table(), i >= 1, i--,
If( N Rows( Data Table( i ) ) == 0,
Close( Data Table( i ), nosave )
)
);