emit close instead of end