Change the Disk class to be a context manager. All code using Disk was updated to the following with statement: with Disk(...) as disk: disk.some_member() This is related to Issue #2412