How to save values after closing a widget and then opening it again?

But what method do I have to use if I want the timer to keep running even after the widget is being closed and yes the timer is inside the widget.