Only closing connect server if in run mode