Neo4j plugin setProperty doesn't seem to work

Given the following code I would expect every node which is created in the database to receive a property CreatedAt.
At the moment some nodes get the CreatedAt property, but others do not.

@Override
public Void beforeCommit(TransactionData data, Transaction transaction, GraphDatabaseService databaseService) throws Exception {
data.createdNodes().forEach(node -> {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSSSSSZ");

    node.setProperty("CreatedAt", ZonedDateTime.now().format(formatter).toString());  
});  

return null;  

}

It seems that sometimes nodes do not get the CreatedAt property, but other times they do.

Am I missing something here?

(Sorry if this is a really vague question, but I can't figure out a possible cause)