Implement context manager support for Collector