This goes after the error check, as file would be nil, also delete the surrounding newlines.