Issue #24717 Fixes Document number sequence with multiple docs open

Fixes Document number sequence with multiple docs open by different people at the same time and subsequent cancelling and re-opening causing document number sequence issues.

Will possibly cause document number gaps if gapless is not enabled.

Should also resolve for all document types.