Polls closed on Sunday for a snap election in Spain that could bring socialist Prime Minister Pedro Sánchez's eight years in power to an end.