8278356: Improve file creation Reviewed-by: andrew Backport-of: 3c75bf069973c1d05b94cb42edf6eb62820b1ef5