Now that you are stretching it over the side of the bed, your knee might be aggravated and tightening up to protect itself from pain- just like when you overuse any muscle and pay for it the next day with stiffness and pain. You might want to shorten the period you let your legs hang for a few days and add a few extra times doing the exercise to make up the difference. The towel under the heel is very gentle too, you might want to try it when you are seated with your legs up icing. I've also found that doing seated straight leg toe touches and holding them helps to stretch out the hamstrings and makes the extension exercises easier.
Have a beautiful day.