Restoring user defined permissions, after creating new files

It is better practice to restore user defined permissions, after creating new files; other way, they could stay in an unexpected state.

(method used in Symfony\Component\HttpFoundation\File)