fix publish and closing