conn: Set some flags *before* calling shutdown callbacks