Added useful snippet of code for ending the application after X seconds