I set a custom folder for tmp files located on a different hard drive I have the program installed on, just a separate drive for data which doesn’t have an operating system on it After closing the project without saving the temp files were still there and after closing audacity the temp files were still there
Some wild speculation here, so don’t take anything in this post for gospel.
If Audacity is unexpectedly interrupted (like the power goes out), it can often recover data the next time it is run. That data has to be kept somewhere in order to do that.
You don’t mention what operating system you are using, but modern ones use what is called “deferred writes” where files are not immediately closed, even when an application calls for it. Those operations are deferred to later when the system is not busy.