Gedit behavior....txt~ extension

the gnome text editor is leaving files with the .txt~ extension…It doesn’t appear to break anything, but does anyone know if there is a reason for this behavior?

Files suffixed with this character are generally known as backup and temporary files under Linux. It’s a convention to save such files with this extension.

Usually, these files are left behind when an editor is forcefully closed, like e.g. due to an abrupt shutdown of the OS. This prevents your current buffer from being unrecoverable, by temporarily saving it on disk in this temporary backup file.