Added support for context manager: closes Issue #9