Have any been able to use pygame run movie in Blender

I been able to start the movie in blender with pygame but when the movie is over i can’t quit from pygame to blender here my code


import pygame
from pygame.movie import *
#from pygame.surface import *
from pygame.display import *
import sys


def main(MPEG,X =1,playing = 1) :
    pygame.init()
    m = Movie(MPEG)
    pygame.display.set_caption('Dino Rolling')
    s = pygame.display.set_mode((1152,864), 0, 32)
    disX = 1152/2 - m.get_size()[0]/2   ### surface to display the mpeg XXX
    disY = 864/2 - m.get_size()[1]/2    ### surface to display the mpeg YYY
    m.set_display(s,[disX, disY])
    while playing == 1:
        m.play()
        pygame.display.flip()
        if m.get_busy() == 0 or X > 10000:
            playing = 0
            m.stop()
           ### sys.exit() --------> ????
            
#if __name__ == '__main__' :
#    main('C:\C.mpeg')
           
            

at the sys.exit() if i use this syntax both pygame and blender would exit
if i use pygame.quit the pygame window wouldm’t quit so how can i get the pygame window to quit ??