Handle closed queries in query end notifier