After the filing of the bankruptcy petition, the debtor needs protection from the collection efforts of its creditors. Therefore, the bankruptcy law provides that the filing of either a voluntary or involuntary petition operates as an automatic stay which prevents creditors from taking action against the debtor. This is similar to an injunction against the creditors of the debtor. The automatic stay ends when the bankruptcy case is closed or dismissed or when the debtor is granted a discharge.