If $X$ is a Hilbert space with scalar product/norm of $Y$ (that is: complete, and thus closed in $Y$) the argument is fine: In this case $A$ (and equivalently $\beta I-A$) is closed, that is, its graph is closed in $Y\times Y$.
However, I suppose that $X$ is endowed with a different scalar product/norm than $Y$. In this case, you cannot conclude that $A$ is closed. By means of an example, pick any non-closed bijective operator $A\colon D(A)\to Y$, $\beta=0$, and endow $X=D(A)$ with the scalar product $\langle x,y\rangle_X=\langle Ax,Ay\rangle_Y$ so that $A$ is even an isometry from $X$ onto $Y$.
Note that the notion of resolvent sets vary slightly in literature, but usually it is required that $(\beta I-A)^{-1}\in B(Y,Y)$ which implies that $\beta I-A$ and thus $A$ is closed. Hence, by this definition closedness of $A$ is necessary to have a non-empty resolvent set.
Maybe I should add that it is non-trivial to prove the existence of a non-closed bijection $A\colon D(A)\to Y$: In fact, one cannot give an “explicit” such example, since it is known that without the axiom of choice (even in ZF+DC when “countable choices” are admissible) it is not possible to prove the existence of any unbounded operator $B\colon Y\to Y$ when $Y$ is a Hilbert space (and $A^{-1}$ would then necessarily be such an operator).