8 – How to programmatically update a file uri in a node

I’m programmatically moving a pdf file and then trying to update the uri in the node. Here’s my code:

$node = DrupalnodeEntityNode::load($nid);
$entity = $node->field_pdf->entity;
if ($entity) {
   $uri = $entity->getFileUri();
   // move the file and update the uri to the new location
   $entity->setFileUri($uri);
   $node->save();
}

The uri is correct–the file gets moved–but the node isn’t saved with the updated uri. What am I doing wrong?