I too believe that when one door closes another door - or window opens. And a better one it will be too. I remember when we were looking for a house to rent. My DH said we will never find one and we had to leave the home we were living in within the month. I told him don't worry something better than what we had will come along just in time. With God's help and positive thinking we did find a better place in time!
Maybe the job truly wasn't right for you and you would have been stuck in it. Something else will come along that fits your qualifications and liking much better!