Fixed problem where unopened files were closed, causing a panic.