Fix random tool extraction fail
Fix random tool extraction fail

when ulimit is quite low (for example, when launching as OSX service) extracting a lot of files in a short timespan breaks this limit and aborts any open() after the event. Solved by explicitely closing the handle as soon as possible.

Solves https://github.com/arduino/webide/issues/2225

arduino/arduino-create-agent,arduino/arduino-create-agent,arduino/arduino-create-agent,arduino/arduino-create-agent