End image context after capturing screenshot

Image context was opened but not ended on capturing screenshot. This fixes it.