Write queue after connect windows

This is code from before, I don't know.