Cleaning up after the Close button is pressed