Try without self, as methods are set on the instance. Also include parameters to __exit__.