added try/finally and closing FileInputStream