Update programmatically Group Audience
Unless you're changing the $node inside a node_save() or something, your changes won't make it into the database unless you add a node_save() after the change to $node.