screen.blit display surface quit code example
Example: display Surface quit
import pygame
running = True
while running:
for event in pygame.event.get_pressed():
if event.type == pygame.QUTI:
running = False
if not(running):
pygame.quit()
break #you got the error because you didn't completely close pygame so add
#so add break after pygame.quit()