HARTFORD, CT — The vote on a bill to erase this fiscal year’s $317 million deficit ended up being much closer than expected.

The House passed the measure mostly along party lines 75 to 74. Two Democratic lawmakers were absent and two others — Rep. Pat Boyd, D-Pomfret, and Rep. Larry Butler, D-Waterbury — voted against the measure.

It’s the same bill that soared unanimously through the Senate in under 15 minutes Tuesday.

But it got bogged down in the House Wednesday when Republicans introduced an amendment that would have kept $150,000 in the ammunition certificate account and replaced it with $300,000 from the film tax credit program.

They argued it was unconstitutional to to sweep money from the ammunition certificate account and use it for general purposes.

House Majority Leader Matt Ritter, D-Hartford, said the constitutionality “is not in doubt,” because it takes more than the $550,000 to run the firearm program in the Department of Emergency Services and Public Protection.

The underlying deficit mitigation plan transfers about $93.4 million from various off-budget accounts to the general fund and would use about $$222.5 million in the Rainy Day Fund to balance the budget.

It’s estimated the state will end the fiscal year on June 30 with a $1 million balance.

The bill now goes to Gov. Dannel P. Malloy for his signature.