utilize "with" method to finalize resource