Praise be to Allah.
There is nothing wrong with you ending your contract for the reasons mentioned, and this does not have anything to do with not being patient in putting up with the hardships of Madeenah, i.e., its heat and difficulties, as mentioned in the hadeeth narrated by Muslim (1363) from Sa‘d ibn Abi Waqqaas (may Allah be pleased with him) who said: The Messenger of Allah (sa) said: “I declare sacred what is between the two lava fields of Madeenah, (and I forbid) cutting of its thorny shrubs or killing of its game.” And he said: “Madeenah is better for them, if only they knew. No one leaves it out of dislike for it but Allaah will put someone better than him in his place, and no one stands firm despite its hardships and difficulties, but I will intercede for him, or be a witness for him, on the Day of Resurrection.”.
And Muslim (1374) narrated from Abu Sa‘eed al-Mahri that he came to Abu Sa‘eed al-Khudri (may Allah be pleased with him) and consulted him about leaving Madeenah, complaining to him about its prices and his large number of dependents, and telling him that he could not bear the hardships and difficulties of Madeenah. He said to him: Woe to you! I do not advise you to do that. I heard the Messenger of Allaah (S) say: “No one bears its hardships with patience and dies, but I will intercede for him, or I will be a witness for him, on the Day of Resurrection, if he is Muslim.”
Al-Nawawi (may Allah have mercy on him) said in Sharh Muslim: Scholars of (Arabic) language said: al-la’waa (hardships) refers to difficulty and hunger. … end quote.
If you leave Madeenah, it will not be because of the hardship and difficulty encountered there; rather it will be to honour your mother and keep yourself chaste. If you can combine the two things and bring your wife and keep in frequent touch with your mother, then you will attain the blessings of living in Madeenah and be included in this great promise of attaining the intercession of the Prophet (blessings and peace of Allah be upon him). Undoubtedly this will be better and more perfect.
We ask Allah to guide us and you.
And Allah knows best.