Handle file mode changes when copying to a new file