I am seeing errors on routers, where every time NCM is done with executing commands on the router, the SSH process creates a log entry indicating the disconnect.
RP/0/RP1/CPU0:Aug 11 15:36:11.906 : SSHD_[65858]: %SECURITY-SSHD-6-INFO_GENERAL : Client closes socket connection
One thing that I tried was to force a disconnect by changing the device template, adding "${CRLF}exit" to the show running-config command line, but that resulted in the scripts thinking there was an invalid termination, and thus it trying to redo the command 3 times over. It did stop logging the error message though.
I opened a case with TAC looking for a way to gracefully disconnect without causing the scripts to retry 3 times (372313). I was informed that there is currently no way to have the system gracefully disconnect upon completion of commands/download of configuration. The internals need to be reworked to make this happen. So, a feature request is being summited, but as with any feature request, needs a bit of community support. If you would like to see this worked on, let it be known.
I do see there are at least some other folks that have similar issues that would be resolved by this. They even look to be worse off as their comments indicate memory leakage on the target device. Re: NCM causing SSH errors when downloading configs?