Move permissions handling after rename.

At least on Linux we lost the executable permission while doing
a rename before setPermissions(...).
Not so urgent in these cases, though more correct.

Change-Id: Ibb1ca9f04fe94732ff22afd004fbf921255df690
Reviewed-by: Kai Koehne <kai.koehne@digia.com>