I am not an expert in Topology but I will try to explain this to the best of my knwledge or understandnis.
A set is closed if it includes its boundary point. Around any boundary point, in any neighborhood, there is at least a point from the set and a point that is not in the set. ie: (0,1] has two boundary points, one that belongs to the set, one that does not. Both belong to the boundary of R - (0,1], thouhgh. This is why the boundary of the complement is always close.
Around any point from Z there are points that are not in Z and a point that is. So, Z contains its boundary and then Z is close.
This is from wikipedia
"Formally, a subset A of a topological space X is dense in X if for any point x in X, any neighborhood of x contains at least one point from A (i.e., A has non-empty intersection with every open subset of X). Equivalently, A is dense in X if and only if the only closed subset of X containing A is X itself. This can also be expressed by saying that the closure of A is X, or that the interior of the complement of A is empty."
For instance, Q is dense in R, R - Q is dense in R. Z is not dense in R.
Let's pick any rational (ie: 1/2) and a neighborhood of it in R whose radius is arbirarily small (ie: center 1/2, radius 10^-200). Can you find other points of Q in it? If you can, then Q is dense.
Now let's pick an integre (ie: -1) and a radius 10^-1. The radius is much bigger, but still I cannot find any other intergers in this new neighborhood.
Hope this helps. Maybe someone else than me can clarify this in a better way.