Added an assert to check if the node was not written in a dirty state
Reset the node dirty bit when writing and skipping the actual write when it is not modified