Fix version display

Also make the file opening more pythonic and strip any dangling newlines.