added close function if video is finished