[beeswax] Only close queries that are not running