onQuit method implementation