The first isn’t properly indented, items under data need to be indented by two spaces. Due to this it gave an error.
In your second example you are passing the data “entity_id: cover.slaapkamer” to the service cover.close_cover. In the first HA doesn’t see any data passed.
Just to add to what @silvrr said, all data for service belongs under data (or data_template.) However, the service handler allows entity_id to be at the same level as service as a shortcut/convenience. So: