In Arabic, we have an expression that literally translates as
Close the door that allows (or would allow) the wind to pass through, and have peace of mind.
We use it as a metaphor for avoiding problematic situations or situations involving potential trouble. For example, if your friend's job is making him unhappy or involves extreme exertion, you could advise him to find another job using this expression. I'm looking for an English expression that's as literally close to this as possible.