Will bankruptcy stop or prevent a lawsuit?

Yes. Filing bankruptcy prevents creditors from suing you and, if you have already been sued, causes any cases against you to be dismissed.