set cookies on shutdown in case of redirect.