Thermodynamics of Weakly Measured Quantum Systems