move chunkedMode and close connection