+to destroy: not called by stopping program?

I need to clean some things up before stopping/quitting a program (via stop button) therefore I put this code into the destroy method. but it seems not to be called this way. is there another way to clean a things up by stopping the program?