Acquire exclusive lock to file write when generating hydrators

I found several php crash just like in this detailed description: http://zecrazytux.net/troubleshooting/php-sigbus-crash-prestashop

HydratorFactory needs to write out files with exclusive lock in case of avoid chrashes at high concurrency. 

Also i brought some code from ProxyFactory and deleted an unused exception.