Energy storage and coherence in closed and open quantum batteries