A couple of points to make:
The need to create thousands of variables on-the-fly typically points to poor program design; in almost every case, a list is more suitable.
Setting all such variables to nil at the end of the program does clear them from the document namespace, but consider that you are essentially creating & clearing global variables that are not local to the scope of your program, and as such, the variable names could potentially clash with identically named variables in the document namespace - this is generally considered bad practice.