Fix types of __exit__ method