adding save function when user go home while playing