In the nick of time.
In the nick of time.
In the nick of time" refers to something happening at the very last moment, just before it's too late. This phrase often carries a sense of relief as it usually means avoiding a negative outcome by a slim margin. Picture finishing a test just as the instructor calls time, or arriving at a station just as the train doors are closing — that's doing something in the nick of time!
He arrived in the nick of time to catch his flight.
He arrived just in time to catch his flight.
She submitted her application in the nick of time.
She submitted her application just before the deadline.
Just in the nick of time, he managed to save the documents before the computer crashed.
He saved the documents right before the computer crashed.