Avoid opening file each time we write