Toward the end of bankruptcy are two separate events: one is receiving a discharge, and the second is the closing of the case. In almost every case the discharge is granted and an order is sent by the courts about 110 days after the filing of the bankruptcy. Once the discharge is entered the automatic bankruptcy stay ends, and creditors are allowed to foreclose if they still have a valid lien. In most case the creditors with valid liens wait for the case to be closed or pay for a motion for relief from the automatic bankruptcy stay so that they have a court order stating that they can foreclose.
Receiving the discharge does not mean that the case is closed, as the trustee will still need to determine what assets if any need to be collected, and distributed to creditors. This process can take a few months or over a year.
The trustees operate under a set of guidelines directing them to make sure a case is fully administered, with all assets collected and distributed within 2 years from the filing date. Trustees want to get things handled as fast as possible, but they have a lot of cases, and may take time to get to your case. If the trustee determines that there are no assets the case will close a lot faster than if there are assets.