Resolve MapBasic Application stops working after too many .tmp files are generated

Products affected: MapInfo Pro™, MapBasic™
MapInfo Professional will stop working when running a MapBasic program if too many *.tmp files are generated.  Once the limit of ~MAP9999.tmp is created, MiPro will stop working.  

Those file types are generally generated in c:\Documents and Settings\<user>\Local Settings\Temp

One way to avoid this in MapBasic is to always write queries to named tables and close them afterwards.
For example:
Select * from MyTable

That creates a table called QueryN, where N is some number. If these tables are not closed when done, then the temporary tables build up.

A better technique is to do something like this:
Select * from MyTable Into TMP

When the program is done with the "temp table", use:
Close Table TMP

This provides a bit more control over what's active in the MapInfo environment and should prevent reaching the temp file limit.
UPDATED:  March 30, 2017