It is easier to use a with block here, since it handled the cleanup automatically.