Fixed small bug that caused an infinite loop while waiting to shut down if pendingWrites returned to be less than 10.