added a statement to close the file reader in the try/finally block