Infinity sum of closed sets which is closed in quotient space I was thinking about this task:

Let $(X, \mathcal{T})$ be topological compact space and $f: X \to \mathbb{R}$ be continuous function. Given is infinity sequence $(a_n)$ such that $a_n \in X$. Check if $A$ is compact in $(X \times \mathbb{R}, \mathcal{T}_{X \times \mathbb{R}})$, where
  $$A = C \cup B$$
  $$C =\lbrace \left(x, f(x)\right) : x \in X \rbrace$$
  $$B =\left\lbrace(a_n, y) : n \in \mathbb{N} ~\wedge~y\in
\left[f(a_n)-\frac{1}{n}; f(a_n)+\frac{1}{n}\right] \right\rbrace$$

I made it. $A$ is compact in that quotient space. In my proof weak point was part in which I showed that $A$ is closed. $C$ is obviously closed, but my proof that $B$ is closed set was so long and my lecturer told 'you made absolutely redundant effort, think why it should be obvious and why proving this is pointless'.
I'm thinking about that from a week, but I still don't get it. It looks like it should be closed. Proof is short in metric space (but we don't have metric space), so probably it is easy. I just don't have good argument.
My question is: why it is obvious that $B$ is closed? I will appreciate any help. Please do not assume that we have metric space.
 A: $B$ itself need not be closed. Let's look at a simple example, take $X = [0,1]$ with the standard topology, $f(x) \equiv 0$, and $a_n = 2^{-n}$ for $n \in \mathbb{N}$. Then it's easily verified that $(0,0) \in \overline{B}\setminus B$.
However, it's not hard to see that $A = C \cup B$ is closed, provided the definition of a compact space is that it is quasicompact and Hausdorff. The conclusion holds for all $T_1$-spaces $X$ (and for non-$T_1$ spaces, we can always find a sequence $(a_n)$ such that $A$ isn't closed), but I'm not aware of anybody defining compact as quasicompact plus $T_1$, so that's an unlikely setting.
Let $(x,y) \in X\times \mathbb{R}\setminus A$. Then in particular $(x,y) \notin C$, i.e. $y \neq f(x)$. Choose $m \in \mathbb{N}$ such that $\frac{3}{m} < \lvert y - f(x)\rvert$. By the continuity of $f$ at $x$, we can find a neighbourhood $U$ of $x$ such that $\lvert f(z) - f(x)\rvert \leqslant \frac{1}{m}$ for all $z \in U$. It follows that the neighbourhood $V := U \times \bigl(y - \frac{1}{m}, y + \frac{1}{m}\bigr)$ of $(x,y)$ doesn't intersect
$$A_m := C \cup \bigcup_{n = m}^\infty \{a_n\}\times \biggl[f(a_n)-\frac{1}{n}, f(a_n) + \frac{1}{n}\biggr].$$
The set
$$B_m := \bigcup_{n = 1}^{m-1} \{a_n\} \times \biggl[f(a_n)-\frac{1}{n}, f(a_n) + \frac{1}{n}\biggr]$$
is closed as a finite union of closed sets (here we use $T_1$, the singleton $\{a_n\}$ is closed if $X$ is $T_1$), and by assumption $(x,y) \notin B_m$, so there is a neighbourhood $W$ of $(x,y)$ with $W\cap B_m = \varnothing$. Then $V\cap W$ is a neighbourhood of $(x,y)$ with $V\cap W \cap A = \varnothing$, showing $(x,y)$ is an interior point of $X\times\mathbb{R}\setminus A$. As $(x,y)$ was arbitrary, the closedness of $A$ is established.
