fix for unnecessary close/dispose calls