Fix bug where using the X button to close the prep tool would not execute cleanup routine