backport of AS7-1833 cli connection management for reload and shutdown
prevent OutOfMemoryError when logging an error (fixed awhile ago in the next versions)