A primary school with a 175-year history is under threat of closure, leaving pupils and staff facing an uncertain future.