implemented pygame to exit the programme