Moved allocation of a Sample in hope of saving on heap space.
Added method publishClustersToFile
Tidying the code.
Added method to get the samples of a cluster.
Closing the outputStream
Writing to file.