Revert "Fix AttributeError on close"

This reverts commit 9a63332fe31aae5a640163de1f9229f83ee85081.