While my roommate slept I erased his essay.
Oh no, you'll need to make it up to him. Why would you erase your roommate's essay while he was sleeping?
Mmm, I don't know. I had too much spare time.
You had to much time on your hands, but that is quite alarming to do to someone and their essay. Apologize after confessing to them you did this, and get busy with other more productive things to occupy your time. Your roommate will be furious if they find out otherwise and try to get revenge on you.
What should I do, whoops. I'm going to apologize to my roommate and explain the reason why I did this.
Yes, you need to apologize and let them know and hope that they do not become too upset because it is wrong to destroy someone's hard work.