Safe Domain Randomization via Uncertainty-Aware Out-of-Distribution Detection and Policy Adaptation