Fix issue with PHP 5.3 in gearmanWorkerTask

The use of $this in anonymous functions is only available in PHP 5.4.
This commit fixes the problem importing the counter to the closure's
scope, passing it by reference.