Factor out macro save function from onPause, also call after add/remove macro