Changed it so that the file name is only written in the navbar if the file loaded successfully. This prevents any file that errors from having its name show up in the navbar.