Creation of entanglement of two atoms coupled to two distant cavities with losses