Simple answer: D O N T
Killing your game without finishing anything leaves possibly hundreds of megabytes of ram allocated, possibly even corrupting your save file if you happen to have auto-save running while killing the game.
The reason it isn't quitting is because you're performing some expesive operation, or running a for-loop with many iterations. The only viable solution is to make the loop check for a quit signal.
An alternative solution
For example, if you have a for-loop with a lot of iterations (e.g. for generating a procedural world), you can do either of two things: Multithreading (the hard way), or use coroutines, this example shows
yield being used to wait a frame for every iteration so Godot can check for inputs or the quit signal, but I recommend to look into
yield and come up with a better solution, as each iteration will take a minimum of one frame this way (1/60th of a second):
func long_loop() -> void:
for i in range(999):
print(i) # Example
yield(get_tree(), "idle_frame") # Allow Godot to update
func _ready() -> void:
get_node("Button").connect("pressed", self, "button_pressed")
func button_pressed() -> void: