Improve the autoclose protocol