I assume by saying "... if user terminate the program...", you do not mean user kills AutoCAD from Task Manager, or turn off the power to the computer. Rather, if it in your code where you provide user option to exit earlier from the code execution if needed, while at the point of exit, the said Transient graphics has already drawn.
It is your code's responsibility to clean up the mess before the code execution is ended, earlier, or to its full completion. The simplest way is to use try...finally... block to guarantee the code in finally... clause being executed. Something like:
// Do something
...
...
try
{
//Show Transient graphics
if (AskUserInput())
{
//Do whatever
}
else
{
//Since user cancels inputting, you can let user exit the process here
return;
}
}
finally
{
// Erase the transient graphics here
}
// You may continue to do more work here
... ...