added check for XBMC quitting