|By Daniel Trotta

|By Daniel Trotta

|By Daniel Trotta

|By Daniel Trotta

(Reuters) - New Jersey and Maine ended partial government shutdowns just in time for the Fourth of July holiday on Tuesday, helping New Jersey Governor Chris Christie move past the embarrassment of being photographed on a beach that had been closed to the public.

Both states had suspended non-essential services for three days after failing to reach budget agreements. Their Republican governors signed the budget bills after late-night negotiations with their respective state legislatures.

New Jersey and Maine were two of nine states that had missed their deadlines for enacting budgets in time for the July 1 start of the fiscal year.

Christie signed a $34.7 billion budget measure that included reshaping the state's largest health insurer, Horizon Blue Cross Blue Shield of New Jersey, which covers 3.8 million people in the state.

All state parks and beaches would be open for the Fourth of July holiday and state offices would be open as usual on Wednesday, the governor said.

Christie had remained unapologetic after the Star-Ledger newspaper captured the photos by hiring a plane to fly the New Jersey coastline, showing Christie with family and friends on a state beach on Sunday that was otherwise deserted because of the shutdown.

The scandal became a popular topic on social media with images of Christie in his beach chair superimposed into places such as famous beach scenes in the movies "From Here to Eternity" and "Planet of the Apes."

Christie played down the kerfuffle.

"If they had flown that plane over the beach and I was sitting next to a 25-year-old blonde in that beach chair next to me, that's a story," Christie said.

While states have mostly recovered since the 2007-2009 recession, their revenue growth has not always kept pace with the national economy.

Illinois is in its third year without an enacted budget. In Connecticut and Pennsylvania, lower-than-anticipated income tax collections exacerbated budget gaps and led to disputes over how to close them.

Maine Governor Paul LePage announced on Twitter that he had signed a budget for the fiscal years 2018 and 2019.

"The Maine state government shutdown is now over. Happy Fourth of July!" LePage said.

"I have signed a budget with no tax increase. I thank the House Republicans for standing strong for the Maine people," he said in a second tweet.Maine state police, parks and offices responsible for collecting revenue had all planned to work through the shutdown, the state's first since 1991.