On the stability and optimal growth of time-periodic pipe flow