gn.general topology – A question about locally compact spaces

Recently I read a book about linear algebraic group written by Ian Macdonald. There is a conclusion which I can’t prove.

It says that if $X$ is locally compact Hausdorff space, then $X$ is compact if and only if, for all locally compact spaces $Y$, the projection $Xtimes Y to Y$ is a closed map. Is it a fact for all topology spaces?

Thank you in advance