Add autoclose for plugin