Ring closure reactions of bifunctional chain molecules