Depending on the data you need to savior you could pass in the data (if it's primitive types) into the Bundle of the Activity and override the onPause method of the activity. The onPause method will be called whenever the Activity closes.
See the activity lifecycle for reference http://developer.android.com/reference/android/app/Activity.html
There are other ways to save the data - you could write it directly to a file on the SD card and then close the stream in the onPause method if the Activity is closed by the OS without finishing the data.
Then when the Activity is opened again you call the onResume method of the Activity and read the data saved inside the Bundle or the file written to the SD card.