Extinction risk in periodically fluctuating environments