sys.exit
will not close the pygame window. You have to use
pygame.quit
but I'd also suggest making the code more like this.
while not gameOver:
for event in pygame.event.get():
if event.type == pygame.QUIT:
gameOver=True
pygame.quit()
sys.exit()
This way it will run through everything and then close out everything as well. Since your new to pygame I'd suggest looking at the tutorial here on this forum. Just go to the tutorial section from the main page --> Game Tutorials --> and there's an entire series for learning pygame by metulburr