Handling activerecord statement invalid exception during sidekiq shutdow...

I am not sure If this is the cleanest way to handle the issue.

Fix https://github.com/mperham/sidekiq/issues/897