Make torch shutdown by camera usage work properly