Move Local::take() into a scope where it is guaranteed to be used

This was causing a mystery crash. Fixed.