overrides for UnitTests
catch exceptions and proper closing or resources