The Borders Railway will be closed over three weekends next month, so that parts of the line can be electrified.