Fixed adding layer using ->contents()

Hello,

I could not create layers with the $layer->contents() method, because on save() the following error was issued:
The file "" was not found or could not be accessed.

The root cause for this was that imc:// uri was set regardless of the origin of the content.

Please review my fix, and apply it to the mainline if you find it appropriate