improve how continuous scan handles the final data points after motion has finished

includes a timeout

some code tidy up
improve daserver error handling when data socket becomes out of sync
Merge branch 'gda-8.40' of ssh://dascgitolite@dasc-git.diamond.ac.uk/gda/gda-core.git into gda-8.40