added auto-close