Added error handling while opening of file.

Except EndOfFile, all other errors are raised.

Signed-off-by: Aravinda VK <mail@aravindavk.in>