Fix segfault when using a file that can't be opened