It looks like your score is not being saved when you quit because you are not listening to the correct notification, this is in the official docs:
On desktop platforms, the MainLoop has a special
MainLoop.NOTIFICATION_WM_QUIT_REQUEST notification that is sent to all nodes when quitting is requested.
MainLoop.NOTIFICATION_WM_GO_BACK_REQUEST is sent instead. Pressing the Back button will exit the application if Application > Config > Quit On Go Back is checked in the Project Settings (which is the default).
(Edited to add format into the constants)