so I am using Thonny since I am a beginner with coding, basically my problem is that I am trying out Pygame and right now I am trying to at least create a window and then close the window when I click the red x button, but everything. Everything runs smoothly until I click the xred X. When I click it, the window doesn't close and all that happens is that the colourful red beach ball thing shows up whenever I hover my mouse over the Pygame window and the window just does not respond, it.
It seems like the pygame.quit()pygame.quit() or pygame.display.quit()pygame.display.quit() functions do not work for some reason. I hope I provided enough information, thanks in advace. I have tried with only the pygame.display.quit() and pygame.quit() separately and still no luck.
import pygame
pygame.init()
Window=pygame.display.set_mode((250, 250))
run=True
while run:
for event in pygame.event.get():
if event.type==pygame.QUIT:
run=False
pygame.quit()
pygame.display.quit()


