More robust file rename