similar to commit f508d29f39 Closes #3443
f508d29f39
Important for when the file is going to be read again and thus must not contain old contents! Adds test 327 to verify. Reported-by: daboul on github Fixes #3299 Closes #3300