add atexit handler for xrefresh