Map C-n to switching between relative and absolute numbering. Automatically switch into relative when in normal mode, and vice versa.
Do relative numbering with <C-n> and save when exiting insert mode.