fixing order of events to hide chatbox after prompt is complete