Fix leak of file descriptor in error path of bc_calc()