Try with resources conversion from Java to Scala #SCL-6808 Fixed