This is essentially a variation on the answer of denesp that requires slightly fewer assumptions.
Assume there are $l$ commodities and $m$ agents. An allocation is then a point in $\mathbb{R}^{lm}_+$. If the aggregate endowment is $e\in\mathbb{R^l}_+$, an allocation is a point in $\sum^{-1}(\{e\})$, where $\sum:\mathbb{R}^{lm}_+\to\mathbb{R}^l$ is the continuous "summation function". Since this function is continuous and the set $\{e\}\subseteq\mathbb{R}^l$ closed, the space of allocations is closed too. It is also clearly bounded, so the space of allocation is compact. Let $A\subseteq\mathbb{R}^{lm}_+$ be the nonempty compact space of feasible allocations.
Define the relation $\succeq$ on $A$ such that for allocations $x=(x_1,\ldots,x_m)$ and $y=(y_1,\ldots,y_m)$, we have $x\succeq y$ if and only if $x_i\succeq_i y_i$ for every agent $i$. Now $x^*\in A$ is a maximal Pareto improvement over $x$ exactly if $x^*\succeq x$ and there is no $y\in A$ such that $y\succeq x^*$ but not $x^*\succeq y$.
Assume now that for all $a\in\mathbb{R}^l_+$ and every agent $i$, the "weakly-better-set" $\{b\in\mathbb{R}^l\mid b\succeq_i a\}$ is closed. Then the set $A_x=\{y\in A\mid y\succeq x\}$ is closed and, as the closed subset of a compact set, compact. Our problem reduces to showing that there exists a $\succeq$-maximal element $x^*\in A_x$.
Let $\succ$ be the asymmetric part of $\succeq$. It is transitive and irreflexive and therefore acyclic. Also, the "upper sections" of $\succeq$ are closed and therefore the lower sections of $\succ$ open. The existence of a $\succ$-maximal element follows then from what is sometimes referred to as the Walker-Bergstrom theorem (first proven by Sloss....). For the sake of completeness, I give the easy proof here.
Let $L_z=\{y\in A_y\mid y\prec z\}$ be the lower set of $\succ$ at $z$. Assume for the sake of contradiction that there is no $\succ$-maximal element in $A_x$. Then every point in $A_x$ lies in some $L_z$ with $z\in A_x$. Also, the $L_z$ are relatively open in the compact space $A_x$. So $\{L_z\mid z\in A_x\}$ is an open cover of $A_x$ and, by compactness, there is a finite set $F\subseteq A_x$ such that $\{L_z\mid z\in F\}$ is still an open cover of $A_x$. In particular, for each $z\in F$, there is some $z'\in F$ such that $z\in L_{z'}$ or, equivalently, $z'\succ z$. So the relation $\succ$ has no maximal element on the finite set $F$. This means there exists an infinite sequence $\langle z_n\rangle$ such that $z_{n+1}\succ z_n$ for all $n$. Since $\succ$ is acyclic, the sequence consists of infinitely many distinct elements. Since $F$ is finite, this is impossible.