Added context manager for BatchProcessor