Save settings on exit.