close functionality working