Solar flare X-ray source motion as a response to electron spectral hardening