close communicator in case of runtime error