Fix bundle file descriptor leaks