Extracted close as method for kafka uploader