Scotland’s historic attractions enjoyed a surge in visitor numbers last year thanks to a rise in international visitors and booming film and TV tourism, new figures reveal.