Add a system to end query correctly