introduce a new exception and use try-with-resources instead of try finally