Black screen after adding swap

Yes, if you back up your files, you should be able to.
You can also check here for more information on recovering with a fresh reinstall:

I am a little concerned by the error. What the error suggests is that the drive itself is not responding to commands.
This usually can be caused by a loose cable. But drive failure can cause it. Off hand, I cannot think of anything that a swapfile might do that could cause the drive to stop responding to commands. I suppose it is possible; but if this was me, I would run a S.M.A.R.T. (test) on the drive.

You can check your terminal history file ~/.bash_history to double check what you entered in against the Digital Ocean guide to see if you had any typographical mistakes.