Removed bogus gz.close from newline_format.rb and added cosine similarity to udfs.py