replaced OpenClosable trait with structural subtyping and withOpenClose with using