This question is a duplicate of this question but none of them answered if it can be closed.
They only suggested alternatives- using try-with or actually
try-with