Fixed a leaky file descriptor