Check shutdown flag after doing select