Some doors are not God’s will for you to enter them and God closes it for your protection. God knows everything and He knows if you’re on a path that leads to danger.
Pray to God continuously to know His will. Rely on the Spirit. The Holy Spirit will tell you if something is God’s will.