You have to enter one of the rooms and get past Smile Dog to trigger an interaction that will "reverse time" and send you back. Repeat this, and then Slenderman will leave.