RPM swings to profit in third quarter