Save written data to localStorage so every thing is written will be saved and retrived if the browser is closed