Check the location of the Audacity temp folder. Look in “Edit > Preferences > Directories”.
What is happening is that the temp files (the actual audio data) is either not being written or is being deleted, so the waveform only exists for the few seconds of data that are cached in ram.
The temp directory must be writeable and have sufficient space for the audio data.
Also check that the temp folder is not being “cleaned” by any security/maintenance applications that you may have installed.
Even if Windows lets you write where you want, you should never save Audacity projects inside your Audacity temporary folder. Look at Edit > Preferences… then “Directories” to make sure you know where your Audacity temp folder is, so that you don’t save projects insider that folder.