Fixes Issue 5243 - Avoid overwriting existing file on posix