Remove expired channel numbers when writing a channel

I'm concerned that this is potentially pretty slow, but writing is fairly infrequent, so hopefully isn't a massive issue. Would welcome suggestions on how to improve efficiency though.