adds closing script at the head