Yes; filing for bankruptcy does not require that you first wait until you have missed payments, defaulted on your debts and obligations, or otherwise already incurred significant damage to your credit rating. Of course, once you file, your credit will hardly remain "perfect," but rather will be substantially negatively impacted for a number of years.