Call function before termination

So, i am trying to handle my own ini files in cinder and I would like to save them right before I close the window. I was wondering if there is a built in cinder function that runs before i close the program I can use. I have tried atexit without success because of my file structure.

ci::app::App::cleanup() will be called if your app is exited deliberately but if you write your ini class using RAII techniques you shouldn’t have to manually write them on exit. E.g

class IniReader
	void Load ( ) { ... }
	void Save ( ) { ... }

	~IniReader ( )
		Save ( );