Ensure enable_delocalization is properly reset

When the yielded block in
with_delocalization_disabled/
with_delocalization_enabled
raises an error, the state of
enable_delocalization gets out of sync.