added auto close