Sailing close to the wind

What does “Sailing close to the wind” mean?

It means that in that activity you are conducting, you are taking risks, and that you are pushing your luck. It means that you are about to fail, or about to get into trouble.