added close functionality