Saves state on change of orientation.