handle SEG_CLOSE and fix #1600