In order to be precise, you should always try to rephrase your sentence if "that" does not follow the object it really refers to.
If that does not folllow the object replacing "that" with "the one that" or with "which"... can suggest that the closest object is not related to the phrase.
"I opened a can on the table that was closest to me."
"I opened a can on the table, the one that was closest to me."
"I opened a can on the table, the can closest to me."
In
"I opened a can on the table that was closest to me."
a reader has no reason not to believe that you meant
closest table.