How do I implement code for ending the programme by clicking the cross at the upper left corner?