I am inquiring as to how I can put a something in the program where the participant can end the experiment at any time they want but the data is still collected?

Thank you