Patching backend script for chrome extension; trying to avoid capture tab from getting stuck