1--you are closing the door, taking away opportunities, so foreign enterprises cannot access a market in country X.
2--you are closing the door that leads to foreign enterprises, taking away opportunities for country X to access foreign enterprises. Even if you probably want the meaning of #1, if you say #2 people should interpret it as #1 because that is what makes logical sense. But grammatically, #2 says something different.
For some more concrete examples:
Keep the door closed to strangers = keep the door closed so that strangers do not enter
Keep the door to strangers closed = this doesn't make sense. There would need to be a door that you use to go meet strangers.
Keep the door to the bathroom closed = keep the door that leads to the bathroom closed = keep the bathroom door closed
Keep the door closed to the bathroom = this doesn't make sense. The bathroom cannot come through the door. People go through the door.