Strain relaxation and formation of screw dislocations in YBCO films on MgO substrates