Fixed relative path file writing.