Kong PDK Closed Network Connection

I’m writing an access control plugin in Go
Everything is fine when the plugin returns a success.
When it tries to return an error, the header and body are set correctly, but there is an info message logged by the gateway

[info] 1411#0: *650 [access-token:1413] 2025/03/10 09:43:13 write unix /usr/local/kong/access-token.socket->@: use of closed network connection, context: ngx.timer

The return in the plugin looks like this, I’ve tried without the return statement thinking that’s where the issue is but with no change to the gateway logs.

kong.Response.Exit(http.StatusUnauthorized, missingToken, errorHeader)
return

Is this expected behaviour, or am I doing something wrong?