cut it close
definition
to do something with very little time to spare
example
We cut it close, but we made it to the airport just in time.
word origin — From shaving — barbers who cut close to the skin saved time but risked nicking the customer's face.