I had this error:
Exception: Serialization of 'Closure' is not allowed in serialize()
during a batch process. Problem seemed to be dependency injection of services in my ModuleBatchService.php
Solution:
The solution was to use the services directly in my processNode method instead of using the services container.