Raise an exception if .add is called outside of context manager.
Raise an exception if .add is called outside of context manager.

PiperOrigin-RevId: 458893445
Change-Id: Ice946ff15f3b0e23ad805a103e616215fbd61a23
GitOrigin-RevId: ba5040778184ea6271b896a798e2b484bcd5597f

deepmind/xmanager,deepmind/xmanager