This kind of thinking is an encouragement because if God shuts the door He will open the right one for you. Only He knows the whole future and He said He will lead you. One step leads to another. You may not see why it had to happen, but in the future you may say "I am thankful". God bless you!