Or hypnapompic hallucinations (hypnagogic is while going to sleep, hypnapompic is while waking up). But most people don't bother to distinguish between the two.