After months of upheaval, Bed Bath & Beyond Inc. has filed for bankruptcy, a decision that will open some Massachusetts real estate in prominent retail centers.