Add timeout to logger flush