Fix file open mode in tests