WRITE_FILLE() rewritten to try to set CHMOD, thanks to Profi-Concept