Made error messages when creating file objects more helpful