ensure freeze on Thread freezes locals (#11831)

The Thread thread variable backport didn't freeze the locals hash. This overrides freeze to freeze locals, and then call super.

https://github.com/rails/rails/issues/11831#issuecomment-22890710