simple terminal window countdown with a function called on timeout