update the main class to catch file close exception in finally clause.