In the exercise of the powers and rights conferred in this chapter no railroad shall remove its line of railway from any incorporated town of more than five hundred inhabitants through which it now runs.