ap: cleanup of process ap message loop