added connection and communicator close() and some cout into the code