Denzel Washington was right, always be thankful for the bad things in life. They open your eyes to see the good things you weren't paying attention to before.
Closed doors are not punishment. They are protection. God will withhold things from you not because He does not care, but because He does. What looks like rejection from God is often redirection toward something better than what you asked for.