Fix unintelligible error when importing empty file

IO#read returns nil for an empty file if given a length argument, which
caused a stack trace when attempting to import a file instead of a
useful error message.
Landing #1805 - Fix unintelligible error when importing empty file