He resigned to avoid being fired, as President Trump has indicated would happen if he failed to leave voluntarily.