improved termination of executorService and exception handling