Added handling for CSV with trailing commas removed

Code inspired by patch from Nick2253.

Change-Id: Iad07bbe9b8d2f89a9551070c64f1363f54101d93