Called when the document has been modified. Updates the dirty state and triggers checkpoint saving if the strategy is set to IMMEDIATE.