Problem: Suppose $(X, \mathcal{S}, \mu)$ is a measure space and $g_{1}, g_{2}, \ldots$ are $\mathcal{S}$ -measurable functions from $X$ to $\mathbf{R}$ such that $\sum_{j=1}^{\infty} \int\left|g_{j}\right| d \mu<\infty .$ Prove that there exists $D \in \mathcal{S}$ such that $\mu(X \backslash D)=0$ and $\lim _{k \rightarrow \infty} g_{k}(x)=0$ for every $x \in D$
Attempt: I know that if $g_j$ did not converge to zero, the sum of the integrals would be infinity, but how could I show this rigorously? As for the part involving the subset $D$, I am a bit unsure how to approach this problem.
Integrals and countable sums are interchangeable for non-negative functions (this is a consequence of the monotone convergence theorem), which implies that $$\sum_{j=1}^{\infty}\int|g_j|\,\mathrm d\mu=\int\left(\sum_{j=1}^{\infty}|g_j|\right)\mathrm d\mu.$$ The integral is finite, which is possible only if the integrand $\sum_{j=1}^{\infty}|g_j|$ is finite except on a set of measure zero. We can denote the set of all points outside that zero-measure set as $D$. If $x\in D$, then we have $\sum_{j=1}^{\infty}|g_j(x)|<\infty$ by construction, which entails that $\lim_{j\to\infty}g_j(x)=0$ (because the absolute convergence of a series implies that the underlying sequence from which the series is constructed converges to $0$).