The railway between Preston and Blackpool North is to reopen after 22 weeks of work to upgrade the tracks.