将以下文本转换为句子，并为每个句子提供词性分析。
I went to the store, but they were closed. I needed to buy milk and eggs.
1. I went to the store, but they were closed.
分析：主语 I（代词）；动词 went（过去式）；介词短语 to the store（表示地点）；连词 but（表示转折）；代词 they（代替 store）；动词 were（过去式）；形容词 closed（表状态）。

2. I needed to buy milk and eggs.
分析：主语 I（代词）；动词 needed（过去式）；不定式短语 to buy milk and eggs（表示需要做的事情）。