Fixed a problem with a file descriptor being left open in the