added close directory call in hls cleanup code