Move close and re-connect to after command promt to give the user a chance to save the database before using clear etc.