Free energy of a heavy quark-antiquark pair in a thermal medium from AdS/CFT