Suppose we have a bounded set $C subset mathbb{R}^n$ that is convex and non-empty.

And suppose the family of linear functions $(f_{x})_{x in mathbb{R}^n}$ given by $f_{x}: C rightarrow mathbb{R}$, $ f_{x}(c) = x.c$ for $c in C$ attain their maximum and minimum in the set $C$.

Does this mean $C$ is closed (and hence compact) in $mathbb{R}^n$?

My idea: I think this does imply $C$ is closed but I am not sure how to write my argument “properly”. For every vector $x in mathbb{R}^n$, there is a point in $C$ that is “furthest” in the direction orthogonal to $x$. Then because we are in a convex set we can just “join up all these points” and our set is closed. But how do I write this formally.

Remark: Also is it true that if a linear function on a convex set attains its maximum/minimum it does so on the boundary?