**How to reproduce**
```
for i in {1..1000}; do echo 'Hello, world!' | clickhouse-local --query "SELECT * FROM table" --structure 's String' | wc -c; done
```

This script hangs.
if (!parse_res.second)
        throw Exception("Cannot parse and execute the following part of query: " + String(parse_res.first), ErrorCodes::SYNTAX_ERROR);
    
    
    auto context = Context(*global_context);
    context.makeSessionContext();
    context.makeQueryContext();
    context.setUser("default", "", Poco::Net::SocketAddress{});
    context.setCurrentQueryId("");
    applyCmdSettings(context);
    
    CurrentThread::QueryScope query_scope_holder(context);
    bool echo_queries = config().hasOption("echo") || config().hasOption("verbose");
    std::exception_ptr exception;
    for (const auto & query : queries)
    {
        ReadBufferFromString read_buf(query);
        WriteBufferFromFileDescriptor write_buf(STDOUT_FILENO);
        if (echo_queries)
        {
            writeString(query, write_buf);
            writeChar('\n', write_buf);
            write_buf.next();
        }
        try
        {
            executeQuery(read_buf, write_buf,  true, context, {});
        }
        catch (...)
        {