Use read/write file utils instead of open directly