Fixes #938 No errors on quick layer deletion

This is the only JS error I found on quick layer delete in Firefox or Chrome. Used ncWMS and WMS layers for testing