Widget "Run Apple Script and Return Value" in Touch Bar group ends with "tell application quit end tell" - application remains open

Hi guys!
I have a Widget that runs this Apple Script and Shows the return value:

tell application "System Preferences"
    reveal anchor "Text" of pane id "com.apple.preference.keyboard"
    delay 0.5
   	    tell application "System Events"
    	tell pop up button 3 of tab group 1 of window 1 of application process "System Preferences"
    		if value is "Automatic by language" then
    			return "🌐"
    		else if (value) is "Français" then
    			return "🇫🇷"
    		else if (value) is "Deutsch" then
    			return "🇩🇪"
    		else if (value) is "Italiano" then
    			return "🇮🇹"
    		else if (value) is "U.S. English" then
    			return "🇺🇸"
    			return "❔"
    		end if
    	end tell
	end tell
end tell

But System Preferences remains open, not minding the "quit" at the end.
The thing is that even if I attach an action to the widget (like the script

tell application "System Preferences"
end tell

I don't manage to quit the app. Even with a double attached action of "delay next action by x secs" and then a quit command.
As the apple script widget is set to always run when widget becomes visible (it's placed in a Touch Bar group) I have now system prefs running in the background nearly all the time, with the text prefs pane open :roll_eyes:.

Is this bug reproducible for anyone, or is it just me? Or am I just really bad in scripting? Any help?