Fix RNG saves in distributed mode.
# What does this PR do?

The newly introduced RNG saves in the Trainer checkpoints can yield to an error when one of the process of local_rank != 0 arrives to the end of the function faster then the process local_rank=0 arrived at the beginning: in this case the subfolder "checkpoint-xxx" is not created yet, so trying to save inside fails.

This PR fixes that.

Fixes #11618