Synthesis of a molecular trefoil knot by folding and closing on an octahedral coordination template.