Closing connect server if test error and RUN_MODE
Fixing #35, #31