Upset about bank fees? Want to close your bank account?

No problem, your bank says. Just one catch: There may be a fee for that.

Many banks across the country, including several in Massachusetts, are charging customers if they close a checking or savings accountwithin several months of opening it. Boston-based Sovereign Bank, Citibank, PNC Bank, and U.S. Bank charge $25. Some smaller financial institutions demand up to $50 to close an account.

The fees, while not new, are attracting more scrutiny from consumers, lawmakers, and regulators as customers have become more aware and increasingly disenchanted with new and higher fees imposed by banks. US Representative Brad Miller, a North Carolina Democrat, recently introduced legislation to prohibit banks from charging customers fees to close a personal checking or savings account. “It is really hard to change banks,’’ Miller said.

Consumer advocates call the fees unjustified. “It’s a way of banks deterring people from closing accounts,’’ said Alex Matjanec, a cofounder of Mybanktracker.com, a consumer finance website that tracks bank fees.

Six of 10 of the nation’s largest retail banks charge fees to close accounts, according to a study last year by the Pew Charitable Trusts, a nonprofit based in Philadelphia. These fees, however, are often buried in a thicket of legal documents, Pew found.

Pew has been pushing banks to disclose all their fees in a standard one-page format upfront and has urged the Consumer Financial Protection Bureau to require them to take that step.

Barbara Anthony, the state’s undersecretary for Consumer Affairs and Business Regulation, said she believes such fees are legal, but Massachusetts consumer protection laws require them to be disclosed up front.

Anthony said account closing fees are another reminder that customers need to read all the disclosure forms carefully before they sign up for a bank account and ask specifically about any possible charges. Many banks have imposed or raised an array of fees in the past few years to offset the weak economy, low interest rates, losses on bad loans, and increased regulation. “These fees can be profit centers for the bank,’’ Anthony said.

U.S. Bank and PNC, two of the nation’s largest regional banks, charge $25 if customers close their accounts within 180 days. Sovereign Bank and Citibank levy the $25 penalty if customers drop their account within 90 days. And People’s United Bank, a Connecticut institution that recently expanded into Boston, charges $20 if customers close an account within six months.

Both PNC and U.S. Bank said the fees are needed to cover the costs of opening a new account. Sovereign, the third-largest retail bank in Massachusetts, said it sometimes waives the fee, but declined further comment. Citibank declined comment and People’s United could not be reached.

Some smaller institutions in other states charge even higher fees. For instance, Northwoods Community Credit Union in Wisconsin charges $50 if customers close a premium checking account within 90 days of opening. Chief executive Susan Schmidt, however, said no one has ever closed their account quickly enough to incur the fee and said the credit union would consider waiving the penalty if customers asked. “We believe in giving our customers a break,’’ Schmidt said.

In Kentucky, Republic Bank & Trust Co. in Louisville requires customers to keep their checking accounts open for a year to avoid a $25 closure fee. The bank could not be reached for comment.

Some banks say they rarely collect the fees. For instance, Salem Five, a community bank with 23 branches, said it adopted its $10 early account closure fee years ago to discourage people from taking advantage of promotions for free items and then promptly withdrawing their money. However, chief marketing officer Martha Acworth said she could not recall any cases where the bank charged the fee. Acworth said the bank is considering eliminating it altogether.

“We almost never enforce it,’’ Acworth said. “We would only do it if we see a case of abuse or fraud.’’

As these fees come under fire, somebanks are abandoning them. JPMorgan Chase & Co., the nation’s largest bank, scrapped its account closure fee in December. Spokesman Patrick Linehan said it was one of more than a half-dozen fees it eliminated to boost customer satisfaction.

“We continually listen to feedback from our customers and make adjustments,’’ Linehan said.

Todd Wallack can be reached at twallack@globe.com. Follow him on Twitter @twallack.

© Copyright 2012 Globe Newspaper Company.