added auto closing function