Jeffries thanks Pelosi before handing gavel to McCarthy