For the most part yes. There is an exception when the person is having a nightmare or a dream and their delusions are coming out such as fear, anger, and so forth. If they die in that state of delusion, then negative karma ripens otherwise person dying in their sleep will have their positive karma ripen.