Positivity of mass for certain spacetimes with horizons