Correcting file open mode for test case render_to_mem