Added a check to emit_to_users in case it is called late after the server has closed.