FileReader reader = null; try { reader = new FileReader(name); ... } finally { if (reader != null) reader.close(); }