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

Products affected: MapInfo Pro, MapBasic
MapInfo Professional stops working while running a MapBasic program once the limit of ~MAP9999.tmp file is created.
These ~MAP .tmp files are generally generated in C:\Documents and Settings\<user>\Local Settings\Temp

To avoid this in MapBasic, writing queries to named tables and close them afterwards is recommended.
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 multiple temporary tables get created at the location.

The above command can be modified as:
Select * from MyTable Into TMP
**When the program is done with the "temp table", use:
Close Table TMP
This should prevent creating numerous temp files.
UPDATED:  December 12, 2019