Fixed crash when open(..) returns an error.