Use shell futures environment for code in %time and %timeit

Closes #6009