Akorn Inc. swings to a loss