Write queue after connect windows

Here i am declaring it first and then initializing it. Maybe I should merge them like in the pipe exmaple?