Can the bank change the locks and lock me out before they foreclose?

A bank cannot lock you out of the property prior to the foreclosure, but under the terms of the Deed of Trust they can likely secure the property and make any necessary repairs. If the lender inspects the property and sees that it is vacant and the doors and windows have been left open they can take reasonable measures to secure the property. Once they do this they typically leave a notice taped to the door. If the owner contacts them the bank should turn over the keys.