Fixed browser close error

Fixed an error where the program would crash if someone attempted to
send a message to a user who closed their browser window.