Make it possible to pass in null as the logger, if you don't want to login exceptions when closing a resource. Not really advisable, but useful when testing and should only really be used for that.