have a close shave

barely avoid an accident