Fix input file opening and closing in MR Client