It's probably going to be ok so long as at least 30 days has passed from the time of your creditor's meeting and your 401k is exempt.
There could be several other factors at play and you should really speak with a bankruptcy attorney in your state to determine if this is a wise course of action.
Please do not accept the preceding as legal advice. The answer is provided for informational purposes. I would encourage you to seek an attorney licensed and practicing in your state for a more complete answer.