Plans to demolish a historic County Durham school due to fears of collapse have been approved by the council.