closed connection error workaround