store cookies to the file only if the cookies are changed