Fixed a autoclose bug