autoclose: fix new document bug