Fix serialization of request, helpers and viewVars when they contain a closure

`CacheHelper::_writeFile()` fails if you have a closure in any of `$this->request`, `$this->_View->helpers` or `$this->_View->viewVars`. An exception is thrown by the call to `serialize()`.

I think this issue would most commonly occur when using a callback custom detector in `CakeRequest`.
I am aware closures can't be serialized. So I would rather an exception we be thrown if someones tries to cache a page with closures involved. If you silently convert them to nulls and things won't work as expected in on cached page the developer will have a tough time figuring out the cause.