Fixed an issue in SingleThreadedExecutor which might cause awaitTermination return before isTerminated() returns true (isTerminated() switches to true after a very short period of time).