bugfix - Truncate the file after a write