Safe Learning of Linear Time-Invariant Systems