Fix temporary_assignment if an exception is raised.
Fix temporary_assignment if an exception is raised.

PiperOrigin-RevId: 309080858

tensorflow/datasets,tensorflow/datasets,tensorflow/datasets,tensorflow/datasets,tensorflow/datasets