Reordered disposal to remove invalid operation exception on shutdown\reset