add finally scope to close InputStream